Quoted Identifiers

  • Isn't setting the Quoted Identifier database option equal to setting the session Quoted Identifier? Here's my problem.

    I have a SQL2K, sp2 server. By default, the database option for quoted identifier is off.

    sp_dboption 'database', 'quoted identifier'

    returns off

    During all of these test, I haven't changed the db option.

    When I perform the following query:

    select "tracie"

    go

    select "'tracie'"

    go

    select 'tracie'

    go

    I get the result set:

    Server: Msg 207, Level 16, State 3, Line 1

    Invalid column name 'tracie'.

    Server: Msg 207, Level 16, State 3, Line 1

    Invalid column name ''tracie''.

    ------

    tracie

    (1 row(s) affected)

    But when I perform the same query, with

    set quoted_identifier off

    go

    proceeding the statement, the results are as follows:

    ------

    tracie

    (1 row(s) affected)

    --------

    'tracie'

    (1 row(s) affected)

    ------

    tracie

    (1 row(s) affected)

    So, does this basically prove that while the dboption for quoted identifier is set to OFF, it didn't work for the session?

    Any ideas would be most appreciated!

  • One thing you have to be careful of is that you're client isn't setting Quoted Identifier on.

    For instance, in Query Analyzer for SQL Server 2000, though Books Online says set quoted_identifier is set to OFF by default, if you click the Reset All button, it's checked on.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply