Quoted Identifiers

The QUOTED_IDENTIFIER setting determines what meaning Microsoft® SQL Server™ gives to double quotation marks (“). When QUOTED_IDENTIFIER is set to OFF, double quotation marks delimit a character string, just as single quotation marks do. When QUOTED_IDENTIFIER is set to ON, double quotation marks delimit an identifier, such as a column name. An identifier must be enclosed in double quotation marks, for example, if its name contains characters that are otherwise illegal in an identifier, including spaces and punctuation, or if the name conflicts with a reserved word in Transact-SQL. Regardless of the QUOTED_IDENTIFIER setting, an identifier can also be delimitted by square brackets.

The meaning of the following statement, for example, depends on whether QUOTED_IDENTIFIER is set to ON or OFF:

SELECT "x" FROM T

  

If QUOTED_IDENTIFIER is set to ON, “x” is interpreted to mean the column named x. If it is set to OFF, “x” is the constant string x and is equivalent to the letter x.

If the previous SELECT statement example were part of a stored procedure created when QUOTED_IDENTIFIER was set to ON, then “x” would always mean the column named x. Even if the QUOTED_IDENTIFIER setting was later switched, and set to OFF, the stored procedure would act as if it were set to ON and treat “x” as the column named x.

When the SQL Server Upgrade Wizard re-creates database objects in SQL Server version 7.0, the QUOTED_IDENTIFIER setting determines how all of these objects behave. If all database objects were created in SQL Server 6.x with the same QUOTED_IDENTIFIER setting, click that setting, either On or Off. If objects were created in SQL Server 6.x with a mix of the two settings, or if you are unsure of the settings used, click Mixed.

With the Mixed option, the SQL Server Upgrade Wizard first converts all objects containing double quotation marks with QUOTED_IDENTIFIER set to ON. The SQL Server Upgrade Wizard then converts any objects that failed to be created with QUOTED_IDENTIFIER set to OFF.


(c) 1988-98 Microsoft Corporation. All Rights Reserved.