-
Question mark in column name
One of the tables in my database was originally designed with a question mark in the column name. When creating my query for jdbc i did this:
String q = "o.\"Cancelled?\" from ORDERS o";
However, this query gives me the following error message:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid column name 'Cancelled@P1'.
Is there a way of stopping the driver from turning the '?' into '@P1'?
I have tried single quotation marks instead of the double ones around the column name and also back ticks, but with no success.
I have also seen an option in a local ODBC connection I have created an option for ansi quoted strings which solves the problem for oDBC queries, is there an equivilant for JDBC?
Thanks to anyone able to help!
Sincerely,
Andrew
-
I have not used jdbc but in transact sql you could use [] to enclose the column name to tell the server to not use the special meaning of ?
Try it out, may be it works
-
Did you try reference table as [Cancelled?]?
-
Thanks for the info, but alas it doesn't seem to do anything different that the double quotation marks, so far I have tried:
o."Cancelled?"
o.[Cancelled?]
o.'Cancelled'
o.`Cancelled`
the first two turn the ? into @P1
the others give me invalid syntax
My guess is that it is taking the ? to mean a parameter (i.e. the first parameter). Is there a way to stop it from doing this?
Last edited by ajmirsky; 03-17-2003 at 11:18 AM.
-
How about o."[Cancelled?]"?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|