weird issue with UPDATE

Posted on 2007-10-05
Last Modified: 2010-03-19
i'm trying to just run a very simple update on a date field in 1 table. i have a datetime field called 1stLetter in a table called _Prospects. so i try

Update _Prospects Set 1stLetter = '1/1/2006' Where ID = 1617

and i get the error "Incorrect syntax near '1'." and i know it's talking about the 1 in '1stLetter' because i have 2 other date fields called 2ndLetter and 3rdLetter and trying each of those gives me errors on 2 and 3 respectively. what the heck is going on?
Question by:craskin
    LVL 75

    Accepted Solution

    Update _Prospects Set [1stLetter] = '1/1/2006' Where ID = 1617
    LVL 27

    Expert Comment

    Do this instead:

    Update _Prospects
    Set [1stLetter] = '1/1/2006'
    Where ID = 1617

    Identifiers in SQL

    The rules for the format of regular identifiers depend on the database compatibility level. This level can be set by using sp_dbcmptlevel. When the compatibility level is 90, the following rules apply:

    The first character must be one of the following:

    A letter as defined by the Unicode Standard 3.2. The Unicode definition of letters includes Latin characters from a through z, from A through Z, and also letter characters from other languages.

    The underscore (_), at sign (@), or number sign (#).

    Certain symbols at the beginning of an identifier have special meaning in SQL Server. A regular identifier that starts with the at sign always denotes a local variable or parameter and cannot be used as the name of any other type of object. An identifier that starts with a number sign denotes a temporary table or procedure. An identifier that starts with double number signs (##) denotes a global temporary object. Although the number sign or double number sign characters can be used to begin the names of other types of objects, we do not recommend this practice.

    Some Transact-SQL functions have names that start with double at signs (@@). To avoid confusion with these functions, you should not use names that start with @@.

    Subsequent characters can include the following:

    Letters as defined in the Unicode Standard 3.2.

    Decimal numbers from either Basic Latin or other national scripts.

    The at sign, dollar sign ($), number sign, or underscore.

    The identifier must not be a Transact-SQL reserved word. SQL Server reserves both the uppercase and lowercase versions of reserved words.

    Embedded spaces or special characters are not allowed.

    Supplementary characters are not allowed.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Viewers will learn how the fundamental information of how to create a table.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now