Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 COMMIT TRANSACTION

Author  Topic 

Edgemere5
Starting Member

4 Posts

Posted - 2010-10-09 : 11:31:51
Usually after every SQL statement I check @@error for any SQL errors.
Is there any point in checking for SQL errors after issuing a COMMIT?
Under what circumstances would the COMMIT result in an error?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-09 : 13:14:38
COMMIT will result in an error only if there is no corresponding BEGIN TRAN.

Errors inside the transaction will be raised before the commit.

You probably want to take a look at TRY/CATCH http://msdn.microsoft.com/en-us/library/ms175976(v=SQL.90).aspx
Go to Top of Page
   

- Advertisement -