Home > SQL Server > SQL SERVER – SET QUOTED_IDENTIFIER – SET Statement @SQLSERVER

SQL SERVER – SET QUOTED_IDENTIFIER – SET Statement @SQLSERVER


SET QUOTED_IDENTIFIER : It allows ISO standard for using quotation marked SQL Server reserved keywords as identifier and literal strings.

So, using this setting we can create an identifier or objrct name with any SQL Server keywords. Normally, we cannot use any keywords as an identifier in the statements.

Usage

SET QUOTED_IDENTIFIER  ON

or

SET QUOTED_IDENTIFIER  OFF

Thumb rule

When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation marks, and literal 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

1. QUOTED_IDENTIFIER is OFF and when we execute the follow SQL query, SQL Server will throw an error message.

create table “table”
(
“int”  int
)

Output

pic12. QUOTED_IDENTIFIER is ON and executing the same SQL query.

pic2Now, I am going to write a select query using the table name “table”.

pic3I hope you have understood the use of QUOTED_IDENTIFIER set statement.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: