SET QUOTED_IDENTIFIER (TSQL Statement)
allows double-quotes to delimit identifiers.
Syntax
SET QUOTED_IDENTIFIER { ON | OFF }
Remarks
This option only affects parsing stage, not execution stage.
When SET QUOTED_IDENTIFIER
is ON (default):
- identifiers can be delimited by double-quotes
"..."
or brackets[...]
- literal strings must be delimited by single quotes
'...'
.
When SET QUOTED_IDENTIFIER
is OFF:
- identifiers can be delimited by brackets
[...]
- literal strings can be delimited by single quotes
'...'
or double-quotes"..."
.
Examples
SET QUOTED_IDENTIFIER ON;
CREATE LOGIN Smith WITH PASSWORD='xjjierknOeTT467f';
CREATE LOGIN [Jean Dupont] WITH PASSWORD='7ezhEpoe74Fgf';
CREATE LOGIN "Pierre Kiroul" WITH PASSWORD='89fhdsauiERE-as';
PRINT 'The logins "Smith", "Jean Dupont" and "Pierre Kiroul" have been created.';
GO
SET QUOTED_IDENTIFIER OFF;
DROP LOGIN Smith;
DROP LOGIN [Jean Dupont];
PRINT 'The logins "Smith" and "Jean Dupont" have been dropped.';
PRINT "The login ""Pierre Kiroul"" has also been dropped.";
The result is:
2016/03/31 02:56:48 --- executing batch example.sql:1 ---
The logins "Smith", "Jean Dupont" and "Pierre Kiroul" have been created.
2016/03/31 02:56:48 return code: 0
2016/03/31 02:56:48 --- executing batch example.sql:26 ---
The logins "Smith" and "Jean Dupont" have been dropped.
The login "Pierre Kiroul" has also been dropped.
2016/03/31 02:56:48 return code: 0