# not recognized in SQL statement

G

Guest

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.
 
S

Steve C. Orr [MVP, MCSD]

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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
news:[email protected]...
 
G

Guest

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 said:
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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
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.
 
G

Guest

Did you try doing what Mr. Orr suggested? I would think that would work too.

Jason

Ksenia said:
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 said:
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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
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.
 
G

Guest

It did not work for me.

Jason L Lind said:
Did you try doing what Mr. Orr suggested? I would think that would work too.

Jason

Ksenia said:
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 said:
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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
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.
 
B

Bob Barrows [MVP]

Is Quoted Identifiers on?
Ksenia said:
It did not work for me.

Jason L Lind said:
Did you try doing what Mr. Orr suggested? I would think that would
work too.

Jason

Ksenia said:
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...


:

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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
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.
 
G

Guest

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 said:
Is Quoted Identifiers on?
Ksenia said:
It did not work for me.

Jason L Lind said:
Did you try doing what Mr. Orr suggested? I would think that would
work too.

Jason

:

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...


:

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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
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.
 
B

Bob Barrows [MVP]

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 said:
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 said:
Is Quoted Identifiers on?
Ksenia said:
It did not work for me.

:

Did you try doing what Mr. Orr suggested? I would think that would
work too.

Jason

:

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...


:

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





"SQL does not recognize #" <SQL does not recognize
#@discussions.microsoft.com> wrote in message
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top