Quoted Identifiers

Support for quoted identifiers has been added to SQL Server 6.0. According to ANSI syntax, use double quotation marks (") to delimit keywords (quoted identifiers), and use single quotation marks (') to delimit string constants. This resolves the conflict with quoted identifiers and string constants during expression evaluation at the parser level. This is included to provide ANSI compatibility for delimited identifiers. Additionally, although not recommended, keywords specified within double quotation marks can now be used as object names. If object names are desired using keywords, reserved words, database technology terms, or names that could cause conflict with future keywords, first attempt to resolve possible conflicts by choosing another word for the object name. When this is not possible, use quoted identifiers.

Quoted identifiers contain as many as 30 characters. The delimited string can contain any combination of characters represented by the current code page, except double quotation marks.

To enforce or remove quoted identifier and string constant resolution at the session level, use the SET statement. This causes the current session to differentiate between single and double quotation marks when evaluating an expression. When QUOTED_IDENTIFIER is turned ON, strings in double quotation marks (") will not be evaluated or checked against keywords.

When you use keywords for object names or portions of object names, the QUOTED_IDENTIFIER option must be set when creating that object, as well as when accessing that object.

Note If an object name or part of an object name (for example, a column) is created using a keyword when the SET QUOTED_IDENTIFIER option is turned ON, then all subsequent references to that object must be made with the SET QUOTED_IDENTIFIER option ON. In general, it is best to avoid using keywords as object names.

When qualifying a column name and a table name in the same statement, be sure to use the same qualifying expressions for each; they are evaluated as strings and must match or an error is returned.