If someone has to create/access the table/column name which is a reserved keyword, you can use the following option.
Syntax:
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER OFF
Description:
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.
Example:
SET QUOTED_IDENTIFIER OFF
CREATE TABLE "select" ("identity" int IDENTITY, "order" int) — Attempt to create a table with a reserved keyword as a name will fail.
SET QUOTED_IDENTIFIER ON
CREATE TABLE "select" ("identity" int IDENTITY, "order" int) — Now It will succeed as the QUOTED_IDENTIFIER is ON.
SELECT "identity", "order" FROM "select" ORDER BY "order"
DROP TABLE "SELECT"
SET QUOTED_IDENTIFIER OFF
--------------------------------------------------------------------------------
Note: By Default QUOTED_IDENTIFIER will be OFF, And in All stored procedures, this has to be handled properly.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|