Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Quoted Identifier Expand / Collapse
Author
Message
Posted Wednesday, June 2, 2010 8:13 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, December 23, 2013 10:48 AM
Points: 116, Visits: 89
Comments posted to this topic are about the item Quoted Identifier
Post #931787
Posted Wednesday, June 2, 2010 8:21 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, September 17, 2014 9:21 AM
Points: 1,676, Visits: 1,757
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
Post #931795
Posted Wednesday, June 2, 2010 9:55 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, June 30, 2014 2:51 AM
Points: 2,045, Visits: 369
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
Post #931817
Posted Wednesday, June 2, 2010 10:49 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, September 5, 2014 2:00 PM
Points: 2,160, Visits: 2,191
Nice question, thanks!

Again, I probably wouldn't hire anyone who admitted to doing this.
Post #931836
Posted Thursday, June 3, 2010 12:42 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 1:50 PM
Points: 1,904, Visits: 793
Good.

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


Regards,
Rals
.
Post #931865
Posted Thursday, June 3, 2010 2:13 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 2:50 AM
Points: 1,419, Visits: 439
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.
Post #931898
Posted Thursday, June 3, 2010 3:25 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 10:09 AM
Points: 6,020, Visits: 8,288
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
Post #931939
Posted Thursday, June 3, 2010 7:04 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 7:24 AM
Points: 873, Visits: 872
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
Post #932092
Posted Thursday, June 3, 2010 9:00 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 7:35 AM
Points: 2,817, Visits: 2,563
As usual, some comments in the forum about the question are as educational as the question and explanation. Thanks.
Post #932210
Posted Thursday, June 3, 2010 9:47 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, September 5, 2014 2:00 PM
Points: 2,160, Visits: 2,191
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.
Post #932249
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse