SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Quoted Identifier


Quoted Identifier

Author
Message
pprashanth
pprashanth
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 89
Comments posted to this topic are about the item Quoted Identifier
Oleg Netchaev
Oleg Netchaev
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2221 Visits: 1817
Good question, thank you. I really hope that nobody actually thinks that it is OK to abuse the database just because the engine allows it.

Oleg
ziangij
ziangij
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3608 Visits: 377
agreed, absolutely !

Oleg Netchaev (6/2/2010)
Good question, thank you. I really hope that nobody actually thinks that it is OK to abuse the database just because the engine allows it.

Oleg

UMG Developer
UMG Developer
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4078 Visits: 2204
Nice question, thanks!

Again, I probably wouldn't hire anyone who admitted to doing this. :-)
rals
rals
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2273 Visits: 843
Good.

but when tried with SET QUOTED_IDENTIFIER OFF; also it is working fine. (in SQL Server 2008).

Regards,
Rals
.

Øystein Fallo
Øystein Fallo
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1537 Visits: 454
rajesh.subramanian (6/3/2010)
Good.

but when tried with SET QUOTED_IDENTIFIER OFF; also it is working fine. (in SQL Server 2008).


That would be because Manangement Studio default options is setting QUOTED_IDENTIFIER ON.
The session-option overrides database setting.
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18933 Visits: 12426
Good question. (Although I hate the ALL CAPS in the code).

The QUOTED_IDENTIFIER option is a rather odd one. Frankly, I am surprised that it's not deprecated, as its only use is for backwartd compatibility.

Ancient versions of SQL Server allowed you to enclose string constans in "double quotes" instead of 'single quotes'. That bit Microsoft when the ANSI standard for SQL decided that 'single quotes' are for delimiting string constants, and "double quotes" are for delimiting identifier names. So in order to adhere to the standard, Microsoft had to change the meaning of the "double quote"; in order to not break existing code, SET QUOTED_IDENTIFIER was introduced.

All major non-Microsoft relational databases use 'single quotes' te delimit strings, "double quotes" to delimit identifiers, and [square brackets] to force syntax errors. MS-Access uses 'single quotes' to start inline comments, "double quotes" to delimit strings, and [square brackets] to delimit identifiers. And SQL Server? Well, under the recommended option (QUOTED_IDENTIFIER ON), it uses 'single quotes' for strings, "double quotes" for identifiers (as per ANSI standard), and [square brackets] for identifiers as well, but this can be changed to use both 'single' and "double" quotes for strings and [square brackets] only for identifiers.

@UMG Developer - I hope the "not hiring" comment refers to the use of "identity" and "string" as identifier names, not to the use of double quotes. Using such identifiers is indeed bad practice, using double quotes to delimit them is not - if might be an indication that the developer has a thousand years of experience in other databases, or that (s)he tries to keep code portable. To name a random example of a developer who prefers double quotes over square brackets when delimiting identifiers: me.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
ronmoses
ronmoses
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1700 Visits: 1011
Right answer, wrong reason. So I got the point and I learned something, cool!

-----
a haiku...

NULL is not zero
NULL is not an empty string
NULL is the unknown

Daniel Bowlin
Daniel Bowlin
SSCrazy Eights
SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)

Group: General Forum Members
Points: 8060 Visits: 2629
As usual, some comments in the forum about the question are as educational as the question and explanation. Thanks.
UMG Developer
UMG Developer
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4078 Visits: 2204
Hugo, yes, my comment is in reference to the naming choices not the use of quotes.

I understand why people might like to use quotes instead of []s, but I personally prefer the []s when necessary.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search