BUG: Incorrect SqlState on Constraint ViolationLast reviewed: May 1, 1997Article ID: Q138540 |
The information in this article applies to:
SYMPTOMSIf the Microsoft SQL Server ODBC Driver encounters a constraint violation it raises a SqlState of 37000 (Syntax error or access violation) instead of 23000 (Constraint violation).
STATUSMicrosoft has confirmed this to be a problem in the Microsoft SQL Server ODBC Driver version 2.50.0121. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. This problem does not occur in version 2.65.0201.
MORE INFORMATIONIf the driver encounters a SQL Server constraint violation, it correctly passes the error message back to the client:
szSqlState = "37000" *pfNativeError = 2627 szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server] Violation of PRIMARY KEY constraint 'PK__testkey__cola__38CE74DF': Attempt to insert duplicate key in object 'testkey'."Instead of raising this with a SqlState of 37000, however, the driver should be raising a SqlState of 23000. This happens on both SQLExecDirect and SQLExecute.
|
Additional query words: sql6 odbc SQLExecDirect SQLExecute
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |