January 26, 2008 at 8:43 pm
Hi,
EX:
SET QUOTED_IDENTIFIER ON
SELECT COL1 FROM TBL1
WHERE status = "STTLD"
and status = "CXL"
my query is not working if idenitifier is in double quotes even SET QUOTED_IDENTIFIER ON /OFF. If I replaced double quotes with single quote its working fine. Can someone please help me out.
January 27, 2008 at 10:29 am
Strings are supposed to be surrounded with single quote marks. Quoted Identifiers allows you to put double quote marks around reserved and key words to use them as objects within the database. For example:
CREATE TABLE "Select"...
SELECT * FROM "Select"
You can use the quotes instead of brackets:
CREATE TABLE [Select]
SELECT * FROM [Select]
Since lots of people are getting into the habit of delineating all objects using brackets and lots of third party sql formatting tools do this for you, brackets are probably a better approach.
For more details, look it up in Books Online.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
January 27, 2008 at 10:50 pm
quoted_identifiers settings are for using reserverd keywords as object names etc. Its not for string values.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply