QUOTED IDENTIFIER ON /OFF IN SQL SERVER 2005

We need to make this option ON when we need to use double quotes in
identifiers.It specifies the setting for usage of double quotation.

SET QUOTED_IDENTIFIER must be ON when reserved keywords are used for object names in the database.

When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by
double quotation marks, and literals must be delimited by single
quotation marks.

When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and
must follow all Transact-SQL rules for identifiers.Literals can be
delimited by either single or double quotation marks.

When SET QUOTED_IDENTIFIER is OFF, literal strings in expressions can be delimited by single or double quotation marks.
If a literal string is delimited by double quotation marks, the string
can contain embedded single quotation marks, such as apostrophes.

Examples are given below

SET QUOTED_IDENTIFIER OFF
GO
CREATE TABLE “select” (“identity” INT IDENTITY NOT NULL, “order” INT NOT NULL)
GO

OUTPUT ( –Error , will not succeed )
________

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ’select’.

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE “select” (“identity” INT IDENTITY NOT NULL, “order” INT NOT NULL)
GO

OUTPUT
________

Command(s) completed successfully.

SELECT * FROM “select”

OUTPUT
________

identity order
———– ———–

(0 row(s) affected)

Pawan Kumar
Pawankkmr@hotmail.com

Advertisements