sql server - Incorrect syntax near '2290' -


query:

insert 2290_form(fk_c_b_key,is_final_return,is_amendment,first_used_month,tax_year)  values ('cf3b908b-8120-493b-993a-b899a61ae77b',0,0,4,2014) 

error:

msg 102, level 15, state 1, line 1
incorrect syntax near '2290'.

how fix error?

you cannot have table name starts number. however, can enclosing table name in []. in instance, query should be:

insert [2290_form] (fk_c_b_key,is_final_return,is_amendment,first_used_month,tax_year)      values ('cf3b908b-8120-493b-993a-b899a61ae77b',0,0,4,2014) 

as per rules regular identifiers:

rules regular identifiers

  1. the first character must 1 of following:

    • a letter defined unicode standard 2.0. unicode definition of letters includes latin characters through z , through z, in addition letter characters other languages.

    • the underscore (_), "at" sign (@), or number sign (#). symbols @ beginning of identifier have special meaning in sql server. identifier beginning "at" sign denotes local variable or parameter. identifier beginning number sign denotes temporary table or procedure. identifier beginning double number signs (##) denotes global temporary object.

    • some transact-sql functions have names start double @ signs (@@). avoid confusion these functions, recommended not use names start @@.

  2. subsequent characters can be:

    • letters defined in unicode standard 2.0.

    • decimal numbers either basic latin or other national scripts.

    • the "at" sign, dollar sign ($), number sign, or underscore.

  3. the identifier must not transact-sql reserved word. sql server reserves both uppercase , lowercase versions of reserved words.

  4. embedded spaces or special characters not allowed.

when used in transact-sql statements, identifiers fail comply these rules must delimited double quotation marks or brackets.

emphasis mine.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -