ACC2000: ODBC Error with Pass-Through Update Query (208481)
The information in this article applies to:
This article was previously published under Q208481 This article applies only to a Microsoft Access database (.mdb).
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you use quotation marks ("") around the values in a pass-through update query, or you send a string that contains an apostrophe (') to Microsoft SQL Server, you may receive the following ODBC error:
ODBC--call failed.
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name '<value>'. (#207)
CAUSE
Beginning with SQL Server 6.0, Microsoft 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 quotation marks (") to enclose identifiers, and apostrophes (') to enclose character string data values. 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 must use apostrophes.
RESOLUTION
Use apostrophes around your values instead of quotation marks. Also, if the string that you are sending already contains an apostrophe, use two apostrophes instead of just one. For example, if you were passing the last name of O'Brien, you would precede the apostrophe with two additional apostrophes (that is, 'O''Brien').
UPDATE authors SET au_lname = 'O''Brien', au_fname = 'John', phone = '999-999-0000' WHERE au_id = '527-72-3246';
REFERENCESFor more information about creating ODBC connections for pass-through queries, click Microsoft Access Help on the
Help menu, type create the odbc connection string for an sql pass-through query in the Office Assistant or
the Answer Wizard, and then click Search to view the topics
returned.
For more information about controlling SQL Server through pass-through queries, click Microsoft Access Help on the
Help menu, type send commands to an sql database using a pass-through query in the Office Assistant or
the Answer Wizard, and then click Search to view the topics
returned.
Modification Type: | Major | Last Reviewed: | 6/30/2004 |
---|
Keywords: | kberrmsg kbinterop kbprb KB208481 |
---|
|