Skip to content

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:

  1. 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 ( #)
  1. Subsequent characters can include decimal numbers, at signs (@), letters, dollar signs ($), number signs (#) or underscores (_).
  2. Identifier cannot be a reserved keyword in T-SQL or SQL
  3. Identifier cannot have embedded spaces
  4. 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“
Clone this wiki locally