-
Notifications
You must be signed in to change notification settings - Fork 0
Delimiters in T SQL
Kristina edited this page Nov 15, 2017
·
1 revision
If a column, table, schema, or object identifier doesn’t mean the following requirements you will have to use delimiters:
- First character must be a letter based on Unicode Standard
- Examples:
- a-z
- A–Z
- Letters from other Unicode languages
- underscore ( _)
- at sign ( @)
- number sign ( #)
- Subsequent characters can include decimal numbers, at signs (@), letters, dollar signs ($), number signs (#) or underscores (_).
- Identifier cannot be a reserved keyword in T-SQL or SQL
- Identifier cannot have embedded spaces
- Identifier cannot include supplementary charters
An identifier that doesn’t comply with these rules is called an irregular identifier and must be delimited.
Microsoft SQL Server has two ways to delimit identifier. One is the SQL standard with uses double quotation marks as in “Customers.Sales” and the other is a proprietary form using square brackets as in [Customers].[Sales].
So if you have a table named 2006Sales you would have to put double quotation marks or square brackets around the table name like in the example below because 2006Sales is an irregular identifier:
SELECT *
FROM “Customers.2006Sales“
Always Learning
- Home
- Websites
- Linux
- Java
- Gradle
- JUnit
- Database