Re: ODBC driver manager mangles delimited column names
From: Sheila (Sheila_at_discussions.microsoft.com)
Date: 06/10/04
- Next message: Luisa B: "Can not delete a DSN from the ODBC Data Sources (Control Panel)"
- Previous message: Dave: "Re: ODBC failure - strange behavior"
- In reply to: Robert Sundström: "Re: ODBC driver manager mangles delimited column names"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Jun 2004 14:17:01 -0700
Thanks Robert, I'm beginning to think you are right. I've just finished running some more tests with the trace logging turned on for the ODBC driver manager. It seems to show that MSQuery is responsible for stripping off my double-quotes.
This is what I get in the log for the automatically generated query:
msqry32 2d0-7b0 ENTER SQLPrepare
HSTMT 00881E70
UCHAR * 0x0019DD68 [ 69] "SELECT analog.name, analog."flag.msgtxt"\ d\ aFROM RTDB.DBO.analog analog"
SDWORD 69
See how nicely my column name is delimited? Naturally this query executes quite properly. My tests also showed that if I bypassed MSQuery altogether and edited the Saved Query file directly (it's readable by Notepad), there was no problem adding another delimited column name, and it ran just fine too.
But... this is what MSQuery has mangled it to after I use it manually edited the query and add an analog."flag.offscan" column:
msqry32 2d0-7b0 ENTER SQLPrepare
HSTMT 00881E70
UCHAR * 0x001A0C70 [ 88] "SELECT analog.name, analog.flag.msgtxt, analog.flag.offscan\ d\ aFROM RTDB.DBO.analog analog"
SDWORD 88
I haven't done that much with MSQuery, but I get the distinct impression from the user comments I've read that it's pretty brain-dead. And I don't suppose my chances of getting Microsoft to fix it are that great... so, bleah. A pox on all of it.
Thanks again for your time.
Sheila
"Robert Sundström" wrote:
> On Thu, 10 Jun 2004 10:09:01 -0700, Sheila
> <Sheila@discussions.microsoft.com> wrote:
> > I've created a table in a datasource that has a column name with an
> > embedded dot in it, so I know that I need to delimit the column name
> > when trying to query the table.
> >
> > When I used Excel and MS Query to automatically construct a query of the
> > table, it appears to construct the query correctly, and adds double
> > quotes to the field names, e.g.
> >
> > SELECT analog.ptnum, analog."flag.msgtxt"
> > FROM RTDB.DBO.analog analog
> >
> > However, if I try to edit the query manually - in any way, even deleting
> > the analog.ptnum column - it suddenly fails. When I turned debug tracing
> > on for my datasource server and odbc driver, I could see that in the
> > case of an auto-generated query, the double-quote delimiters were passed
> > on intact to my datasource server. However, if the query was edited
> > manually, then the query was stripped of the delimiters.
> >
> > Initially I thought it was a bug in the ODBC driver, but I tried the
> > same thing with a table in a MS SQL Server 2000 database, and MS Query
> > exhibited the same behaviour.
> >
> > This sounds like a ODBC driver manager problem. Is anyone out there
> > familiar with it, or are there any settings or configurations that I
> > would play with to force the driver/driver manager to leave the
> > delimiters alone?
>
> I am pretty sure your problem is related to the application you are using
> (Microsoft Query). The Driver Manager has no code to parse and make
> changes to SQL language string supplied by the application. You may rule
> this possibility out by trying to execute that query using any other
> ODBC-based query tool.
>
> Also, I know for sure that all client applications I have tried on Windows
> to access a Mimer SQL backend database through the Microsoft Driver
> Manager has no problems at all with quoted identifiers.
> --
> Robert Sundström, Mimer SQL Development
> Mimer Information Technology AB, http://www.mimer.com
> Validate your SQL statements/procedures at
> http://developer.mimer.com/parser
>
- Next message: Luisa B: "Can not delete a DSN from the ODBC Data Sources (Control Panel)"
- Previous message: Dave: "Re: ODBC failure - strange behavior"
- In reply to: Robert Sundström: "Re: ODBC driver manager mangles delimited column names"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|