ACC: Pass-Through Update Query - ODBC Error (#207) to SQL 6.0 (149065)
The information in this article applies to:
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q149065
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you use double quotation marks (") around the values in a pass-through
update query, or you send a string that contains a single quotation mark
(') as in (like ''O Brien') to Microsoft SQL 6.0, you may receive an ODBC
call Failed error message with the error "(#207) 'the value' is not a valid
column name." This error does not occur when you use the ISQL/w tool with the Microsoft SQL 6.0 client utilities.
CAUSE
Microsoft SQL Server version 6.0 introduced support for ANSI SQL quoted
identifiers. Clients can set a connection option asking the server to
enforce the ANSI quoted identifier rules for SQL commands sent to it over
that connection. ANSI SQL expects double quotation marks (") to enclose
identifier and single quotation marks (') to enclose character string data
values. Double quotation marks are the identifier delimiter in ANSI SQL,
not the string delimiter. In order for this to be a valid pass-through
query, you need to use single quotation marks.
The reason for the different behavior between ISQL/W and the pass-through
query is that ISQL/W uses DB-LIB, which has a different default behavior
than the Microsoft SQL 6.0 ODBC driver which is used by the pass-through
query. The ODBC driver sets QUOTED_IDENTIFIERS ON when it runs against a
Microsoft SQL Server version 6.0 server so that the driver's behavior more
closely matches the ANSI and ODBC standards. ODBC applications that use
double quotation marks for parameter values may see this behavior after you
upgrade to Microsoft SQL Server version 6.0 and the ODBC 2.50.0121 driver.
DB-Library clients such as ISQL/W can also exhibit this behavior if they
issue a SET QUOTED_IDENTIFIER ON command.
RESOLUTION
Use single quotation marks for your values instead of double quotation
marks. And, if the string you are sending contains a single quotation mark,
use two single quotation marks instead of one, as in the example:
UPDATE authors SET authors.au_lname = '''O Brien', authors.au_fname =
'John', authors.phone = '999-999-0000'
WHERE (((authors.au_id)='527-72-3246'));
REFERENCES
For more information about creating pass-through queries, search the Help
Index for "Pass-Through queries," or ask the Microsoft Access 97 Office
Assistant.
Modification Type: | Major | Last Reviewed: | 5/7/2003 |
---|
Keywords: | kbinterop kbprb KB149065 |
---|
|