FIX: Failed Sp_prepare Incorrectly Closes TransactionID: Q198265
|
Failure to prepare a statement, either by means of ODBC or OLE DB, incorrectly results in the failure of the entire transaction. Potential causes for such a failure include syntax errors or incorrect object names in the statement. Subsequent operations that depend on the transaction being active, including attempts to commit the transaction, will fail.
SQL Server incorrectly closes the whole transaction after any error, rather than stopping execution of the statement only.
To work around this problem, execute the statement without first preparing it, using SQLExecDirect or ICommandText::Execute. An error during either of these operations will cause only the statement, rather than the whole the transaction, not to be processed. The application can then determine the appropriate response, such as ignoring the error and continuing with other statements, resubmitting the query without the problem, or rolling back the transaction.
Microsoft has confirmed this to be a problem in SQL Server
version 7.0. This problem has been corrected in U.S. Service Pack 1
for Microsoft SQL Server version 7.0. For information about
downloading and installing the latest SQL Server Service Pack, see
http://support.microsoft.com/support/sql/.
For more information, contact your primary support provider.
Attempts to commit or roll back the transaction after it has been
prematurely closed may result in the following errors:
Msg 3902
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
Msg 3903
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
Additional query words:
@@trancount xact abort sp_prepare rollback terminate aborts terminates
aborted terminated oledb
Keywords : SSrvGen SSrvProg SSrvTran_SQL kbbug7.00 kbSQLServ700bug
Version : winnt:7.0
Platform : winnt
Issue type : kbbug
Last Reviewed: June 7, 1999