Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 1.34 KB

errors-and-batches.md

File metadata and controls

28 lines (23 loc) · 1.34 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
Errors and Batches
Errors and Batches
David-Engel
davidengel
01/19/2017
sql
connectivity
conceptual
batches [ODBC], errors
sql_success_with_info [ODBC]
sql_success [ODBC]
SQL statements [ODBC], batches
sql_error [ODBC]

Errors and Batches

When an error occurs while executing a batch of SQL statements, one of the following four outcomes are possible. (Each possible outcome is data source-specific and might even depend on the statements included in the batch.)

  • No statements in the batch are executed.

  • No statements in the batch are executed and the transaction is rolled back.

  • All of the statements before the error statement are executed.

  • All of the statements except the error statement are executed.

In the first two cases, SQLExecute and SQLExecDirect return SQL_ERROR. In the latter two cases, they may return SQL_SUCCESS_WITH_INFO or SQL_SUCCESS, depending on the implementation. In all cases, further error information can be retrieved with SQLGetDiagField, SQLGetDiagRec, or SQLError. However, the nature and depth of this information is data source-specific. Furthermore, this information is unlikely to exactly identify the statement in error.