Choose your SQL server:
AnySQL
MySQL
MS SQL Server
PostgreSQL
Oracle
SQL Anywhere
DB2
SQLite
Firebird
MaxDB

Subscribe to our newsletter

MS SQL Maestro online Help

Prev  Return to chapter overview Next 

Microsoft SQL identifiers

The rules for the format of regular identifiers depend on the database compatibility level. Usually the following rules apply:

 

1. 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. An identifier that starts with the "at" sign denotes a local variable or parameter. 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.

 

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 @@.
 

2. 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.
 

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

4. Embedded spaces or special characters are not allowed.
 

When they are used in Transact-SQL statements, identifiers that do not comply with these rules must be delimited by double quotation marks or brackets.



Prev  Return to chapter overview Next