# not recognized in SQL statement

Discussion in 'ASP .Net' started by =?Utf-8?B?U1FMIGRvZXMgbm90IHJlY29nbml6ZSAj?=, Jul 13, 2005.

  1. I have the following string that will not work - I get SQLCODE: -206 error:
    (table has the field cust#)

    "select cust#, name, address from table"

    I've tried using alias, and it still gives an error:
    "select cust# as cust, name, address from table"

    The same string works if I eliminate cust# and this same selection string
    works on other workstations, except mine.
     
    =?Utf-8?B?U1FMIGRvZXMgbm90IHJlY29nbml6ZSAj?=, Jul 13, 2005
    #1
    1. Advertising

  2. The field name has a pound(#) sign in it? That's unusual, but it should
    still work if you put brackets around it I'd think:

    select [cust#], name, address from table

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net



    "SQL does not recognize #" <SQL does not recognize
    #@discussions.microsoft.com> wrote in message
    news:...
    >I have the following string that will not work - I get SQLCODE: -206 error:
    > (table has the field cust#)
    >
    > "select cust#, name, address from table"
    >
    > I've tried using alias, and it still gives an error:
    > "select cust# as cust, name, address from table"
    >
    > The same string works if I eliminate cust# and this same selection string
    > works on other workstations, except mine.
     
    Steve C. Orr [MVP, MCSD], Jul 13, 2005
    #2
    1. Advertising

  3. Yes, the field has a pound singn in it ,and that creates problem only when I
    run web application from my local machine. It runs fine on the server or on
    other machines...


    "Steve C. Orr [MVP, MCSD]" wrote:

    > The field name has a pound(#) sign in it? That's unusual, but it should
    > still work if you put brackets around it I'd think:
    >
    > select [cust#], name, address from table
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    >
    > "SQL does not recognize #" <SQL does not recognize
    > #@discussions.microsoft.com> wrote in message
    > news:...
    > >I have the following string that will not work - I get SQLCODE: -206 error:
    > > (table has the field cust#)
    > >
    > > "select cust#, name, address from table"
    > >
    > > I've tried using alias, and it still gives an error:
    > > "select cust# as cust, name, address from table"
    > >
    > > The same string works if I eliminate cust# and this same selection string
    > > works on other workstations, except mine.

    >
    >
    >
     
    =?Utf-8?B?S3Nlbmlh?=, Jul 13, 2005
    #3
  4. Did you try doing what Mr. Orr suggested? I would think that would work too.

    Jason

    "Ksenia" wrote:

    > Yes, the field has a pound singn in it ,and that creates problem only when I
    > run web application from my local machine. It runs fine on the server or on
    > other machines...
    >
    >
    > "Steve C. Orr [MVP, MCSD]" wrote:
    >
    > > The field name has a pound(#) sign in it? That's unusual, but it should
    > > still work if you put brackets around it I'd think:
    > >
    > > select [cust#], name, address from table
    > >
    > > --
    > > I hope this helps,
    > > Steve C. Orr, MCSD, MVP
    > > http://SteveOrr.net
    > >
    > >
    > >
    > > "SQL does not recognize #" <SQL does not recognize
    > > #@discussions.microsoft.com> wrote in message
    > > news:...
    > > >I have the following string that will not work - I get SQLCODE: -206 error:
    > > > (table has the field cust#)
    > > >
    > > > "select cust#, name, address from table"
    > > >
    > > > I've tried using alias, and it still gives an error:
    > > > "select cust# as cust, name, address from table"
    > > >
    > > > The same string works if I eliminate cust# and this same selection string
    > > > works on other workstations, except mine.

    > >
    > >
    > >
     
    =?Utf-8?B?SmFzb24gTCBMaW5k?=, Jul 13, 2005
    #4
  5. It did not work for me.

    "Jason L Lind" wrote:

    > Did you try doing what Mr. Orr suggested? I would think that would work too.
    >
    > Jason
    >
    > "Ksenia" wrote:
    >
    > > Yes, the field has a pound singn in it ,and that creates problem only when I
    > > run web application from my local machine. It runs fine on the server or on
    > > other machines...
    > >
    > >
    > > "Steve C. Orr [MVP, MCSD]" wrote:
    > >
    > > > The field name has a pound(#) sign in it? That's unusual, but it should
    > > > still work if you put brackets around it I'd think:
    > > >
    > > > select [cust#], name, address from table
    > > >
    > > > --
    > > > I hope this helps,
    > > > Steve C. Orr, MCSD, MVP
    > > > http://SteveOrr.net
    > > >
    > > >
    > > >
    > > > "SQL does not recognize #" <SQL does not recognize
    > > > #@discussions.microsoft.com> wrote in message
    > > > news:...
    > > > >I have the following string that will not work - I get SQLCODE: -206 error:
    > > > > (table has the field cust#)
    > > > >
    > > > > "select cust#, name, address from table"
    > > > >
    > > > > I've tried using alias, and it still gives an error:
    > > > > "select cust# as cust, name, address from table"
    > > > >
    > > > > The same string works if I eliminate cust# and this same selection string
    > > > > works on other workstations, except mine.
    > > >
    > > >
    > > >
     
    =?Utf-8?B?S3Nlbmlh?=, Jul 13, 2005
    #5
  6. =?Utf-8?B?S3Nlbmlh?= <> wrote in
    news:D:
    > It did not work for me.


    Try

    Select "Cust#"

    I assuem this is an existing DB? Did you choose the field name or did someone else?


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"

    Develop ASP.NET applications easier and in less time:
    http://www.atozed.com/IntraWeb/
     
    Chad Z. Hower aka Kudzu, Jul 13, 2005
    #6
  7. Is Quoted Identifiers on?
    Ksenia wrote:
    > It did not work for me.
    >
    > "Jason L Lind" wrote:
    >
    >> Did you try doing what Mr. Orr suggested? I would think that would
    >> work too.
    >>
    >> Jason
    >>
    >> "Ksenia" wrote:
    >>
    >>> Yes, the field has a pound singn in it ,and that creates problem
    >>> only when I run web application from my local machine. It runs fine
    >>> on the server or on other machines...
    >>>
    >>>
    >>> "Steve C. Orr [MVP, MCSD]" wrote:
    >>>
    >>>> The field name has a pound(#) sign in it? That's unusual, but it
    >>>> should still work if you put brackets around it I'd think:
    >>>>
    >>>> select [cust#], name, address from table
    >>>>
    >>>> --
    >>>> I hope this helps,
    >>>> Steve C. Orr, MCSD, MVP
    >>>> http://SteveOrr.net
    >>>>
    >>>>
    >>>>
    >>>> "SQL does not recognize #" <SQL does not recognize
    >>>> #@discussions.microsoft.com> wrote in message
    >>>> news:...
    >>>>> I have the following string that will not work - I get SQLCODE:
    >>>>> -206 error: (table has the field cust#)
    >>>>>
    >>>>> "select cust#, name, address from table"
    >>>>>
    >>>>> I've tried using alias, and it still gives an error:
    >>>>> "select cust# as cust, name, address from table"
    >>>>>
    >>>>> The same string works if I eliminate cust# and this same
    >>>>> selection string works on other workstations, except mine.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Jul 13, 2005
    #7
  8. Yes it is existing DB. And it worked fine just couple of weeks ago. I think
    it may be some 'setup' issue, but I don't know where to start looking.

    Where do I check the status for Quoted Identifiers?

    Thanks.
    "Bob Barrows [MVP]" wrote:

    > Is Quoted Identifiers on?
    > Ksenia wrote:
    > > It did not work for me.
    > >
    > > "Jason L Lind" wrote:
    > >
    > >> Did you try doing what Mr. Orr suggested? I would think that would
    > >> work too.
    > >>
    > >> Jason
    > >>
    > >> "Ksenia" wrote:
    > >>
    > >>> Yes, the field has a pound singn in it ,and that creates problem
    > >>> only when I run web application from my local machine. It runs fine
    > >>> on the server or on other machines...
    > >>>
    > >>>
    > >>> "Steve C. Orr [MVP, MCSD]" wrote:
    > >>>
    > >>>> The field name has a pound(#) sign in it? That's unusual, but it
    > >>>> should still work if you put brackets around it I'd think:
    > >>>>
    > >>>> select [cust#], name, address from table
    > >>>>
    > >>>> --
    > >>>> I hope this helps,
    > >>>> Steve C. Orr, MCSD, MVP
    > >>>> http://SteveOrr.net
    > >>>>
    > >>>>
    > >>>>
    > >>>> "SQL does not recognize #" <SQL does not recognize
    > >>>> #@discussions.microsoft.com> wrote in message
    > >>>> news:...
    > >>>>> I have the following string that will not work - I get SQLCODE:
    > >>>>> -206 error: (table has the field cust#)
    > >>>>>
    > >>>>> "select cust#, name, address from table"
    > >>>>>
    > >>>>> I've tried using alias, and it still gives an error:
    > >>>>> "select cust# as cust, name, address from table"
    > >>>>>
    > >>>>> The same string works if I eliminate cust# and this same
    > >>>>> selection string works on other workstations, except mine.

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    >
     
    =?Utf-8?B?S3Nlbmlh?=, Jul 13, 2005
    #8
  9. You can set it at the Connection level by executing this T-SQL statement:
    SET QUOTED_IDENTIFIER ON

    Or you can set it at the database level using Enterprise Manager to access
    the database properties.

    I don't understand why using brackets [] did not "work". Did you get the
    same error message?

    Bob Barrows
    Ksenia wrote:
    > Yes it is existing DB. And it worked fine just couple of weeks ago. I
    > think it may be some 'setup' issue, but I don't know where to start
    > looking.
    >
    > Where do I check the status for Quoted Identifiers?
    >
    > Thanks.
    > "Bob Barrows [MVP]" wrote:
    >
    >> Is Quoted Identifiers on?
    >> Ksenia wrote:
    >>> It did not work for me.
    >>>
    >>> "Jason L Lind" wrote:
    >>>
    >>>> Did you try doing what Mr. Orr suggested? I would think that would
    >>>> work too.
    >>>>
    >>>> Jason
    >>>>
    >>>> "Ksenia" wrote:
    >>>>
    >>>>> Yes, the field has a pound singn in it ,and that creates problem
    >>>>> only when I run web application from my local machine. It runs
    >>>>> fine on the server or on other machines...
    >>>>>
    >>>>>
    >>>>> "Steve C. Orr [MVP, MCSD]" wrote:
    >>>>>
    >>>>>> The field name has a pound(#) sign in it? That's unusual, but it
    >>>>>> should still work if you put brackets around it I'd think:
    >>>>>>
    >>>>>> select [cust#], name, address from table
    >>>>>>
    >>>>>> --
    >>>>>> I hope this helps,
    >>>>>> Steve C. Orr, MCSD, MVP
    >>>>>> http://SteveOrr.net
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> "SQL does not recognize #" <SQL does not recognize
    >>>>>> #@discussions.microsoft.com> wrote in message
    >>>>>> news:...
    >>>>>>> I have the following string that will not work - I get SQLCODE:
    >>>>>>> -206 error: (table has the field cust#)
    >>>>>>>
    >>>>>>> "select cust#, name, address from table"
    >>>>>>>
    >>>>>>> I've tried using alias, and it still gives an error:
    >>>>>>> "select cust# as cust, name, address from table"
    >>>>>>>
    >>>>>>> The same string works if I eliminate cust# and this same
    >>>>>>> selection string works on other workstations, except mine.

    >>



    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Jul 14, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dna
    Replies:
    1
    Views:
    1,282
  2. William \(Bill\) Vaughn
    Replies:
    0
    Views:
    454
    William \(Bill\) Vaughn
    Aug 21, 2003
  3. David Browne
    Replies:
    0
    Views:
    464
    David Browne
    Aug 21, 2003
  4. S. Justin Gengo
    Replies:
    0
    Views:
    504
    S. Justin Gengo
    Aug 26, 2003
  5. weiwei

    asp and sql statement in sql server db

    weiwei, Sep 22, 2004, in forum: ASP General
    Replies:
    3
    Views:
    207
    Jeff Cochran
    Sep 22, 2004
Loading...

Share This Page