521
Chapter 19: Confi guring SQL Server
19
Use Quoted Identifier
The QUOTED_IDENTIFIER setting enables you to refer to an identifi er, such as a column
name, by enclosing it within double quotes. When set to ON, identifi ers can be delimited by
double quotation marks. When set to OFF, identifi ers cannot be placed in quotation marks
and must not be keywords. The default database setting for QUOTED_IDENTIFIER is OFF.
To change the value to ON, use the following code.
To set QUOTED_IDENTIFIER in code at the connection level, do the following:
SET QUOTED_IDENTIFIER ON;
If QUOTED_IDENTIFIER is not specifi ed, then the settings of the current database apply.
To enable QUOTED_IDENTIFIER for the AdventureWorks2012 sample database in code, do
the following:
ALTER DATABASE AdventureWorks2012 SET QUOTED_IDENTIFIER ON;
To enable QUOTED_IDENTIFIER at the server level in code, do the following:
EXEC sp_configure 'user options', 256;
RECONFIGURE;
When dealing with indexes on computed columns and indexed views, four of these defaults (ANSI_NULLS, ANSI_
PADDING, ANSI_WARNINGS, and QUOTED_IDENTIFIER) must be set to ON.
Trigger Confi guration Properties
The trigger confi guration properties, as shown in Table 19-11, control trigger behavior in
SQL Server.
TABLE 19-11 Trigger Confi guration Properties
Property Level* Graphic Control Code Option
Allow Nested
Tr igg er s
S Management Studio EXEC sp_configure 'nested
triggers'
Recursive Triggers D Management Studio ALTER DATABASE <DB Name> SET
recursive_triggers
* The confi guration level refers to server, database, or connection.
Trigger behavior can be set at both the server and database levels.
c19.indd 521c19.indd 521 7/30/2012 5:43:11 PM7/30/2012 5:43:11 PM
http://www.it-ebooks.info