Ispirer Ispirer
 


Ispirer Home Page Ispirer SQLWays Product Page - Migration to SQL Server Request SQLWays

SQL Server - Identifiers

This article describes identifiers in Microsoft SQL Server.

Identifier Rules

SQL Server - Identifier Rules
First Character An alphabetical character, underscore (_), at sign (@) and pound sign (#)
Subsequent Characters Alphanumeric characters, underscore (_), dollar sign ($), pound sign (#) and at sign (@)
Maximum Length 128 characters
Case Sensitivity Identifiers are case insensitive
Standards ANSI SQL - $ is not allowed

Identifiers - Differences between SQL Server and other Databases

Database Identifiers First Character Subsequent Characters Max Length
Oracle Oracle Identifiers Not allowed: _ , @ and # Not allowed: @ 30
IBM DB2 IBM DB2 Identifiers Not allowed: _ , @ and # Not allowed: @, # and $ 128
MySQL MySQL Identifiers Allowed: digit
Not allowed: _, @ and #
Not allowed: # and @ 64
PostgreSQL PostgreSQL Identifiers Not allowed: @ and # Not allowed: # and @ 63
Sybase ASE Sybase ASE Identifiers No differences No Differences 255
Sybase ASA Sybase ASA Identifiers Allowed: $ No Differences 128
Informix Informix Identifiers Not allowed: @ and # Not allowed: @ and # 128
Teradata Teradata Identifiers Allowed: $ No differences 30
HP Neoview HP Neoview Identifiers Not allowed: _, @ and # Not allowed: @, # and $ 128
Interbase/Firebird Interbase/Firebird Identifiers Not allowed: _, @ and # Not allowed: @, # 67

Quoted or Delimited Identifiers

SQL Server - Quoted Identifiers
Quotation Marks Double quotation marks (””) or brackets ([]).
When QUOTED_IDENTIFIER option is set to OFF, only brackets ([]) can be used to delimit identifiers (double quotation marks are used to delimit character strings)
Characters Any characters except the quotation marks
Maximum Length 128 characters, not including the quotation marks
Case Sensitivity Case insensitive. For example, “tab 1” and “Tab 1” are considered the same
Notes When QUOTED_IDENTIFIER is set to ON, SQL Server follows the SQL-92 rules for the use of double quotation marks (”) and the single quotation mark (') in SQL statements.

Quoted Identifiers - Differences between SQL Server and other Databases

Database Identifiers Quotation Marks Characters Case Sensitivity
Oracle Oracle Quoted Identifiers ”” Any except quotes Case sensitive
IBM DB2 IBM DB2 Quoted Identifiers ”” Any including quotes Case sensitive
MySQL MySQL Quoted Identifiers `` and ”” Any except quotes Case sensitive
PostgreSQL PostgreSQL Quoted Identifiers ”” Any including quotes Case sensitive
Sybase ASE Sybase ASE Quoted Identifiers [] and ”” Any except pound sign (#) as the first character Case insensitive
Sybase ASA Sybase ASA Quoted Identifiers [] and ”” Any Case insensitive
Informix Informix Quoted Identifiers ”” Any including quotes Case sensitive
Teradata Teradata Quoted Identifiers ”” Any including quotes Case insensitive
HP Neoview HP Neoview Quoted Identifiers ”” Any except at sign (@), forward slash (/),
circumflex character (^) as the first character
and space(s) as the last character(s)
Case sensitive
Interbase/Firebird Interbase/Firebird Quoted Identifiers ”” Any character except space(s) as the last character(s) Case sensitive


Ispirer Home Page Ispirer SQLWays Product Page - Migration to SQL Server Request SQLWays

sqlways/sql-server/identifiers.txt · Last modified: May 07, 2018, 03:15:32 PM (external edit)
 
© 1999-2018, Ispirer Systems Ltd.
All Rights Reserved.  Privacy Statement