looking for a brokerage account or IRA... click here Add To Favorites
return to index 

Transactions Inside of SQL Stored Procedures

Execute Rollback and Commit inside of Stored Procedures

It is possible to execute a ROLLBACK or COMMIT inside stored procedures and triggers. However, unless carefully implemented, it may cause errors.

SQL Stored Procedures

An informational error will arise of the number of transactions before and after a stored procedure is different. To determine the number of current transactions, simply check the system variable of @@TRANCOUNT. There are two common ways that a difference in transaction count can arise. First, if the @@TRANCOUNT is greater than 0 and the stored procedure executes a ROLLBACK, then the informational error will arise. Second, if the store procedures executes a COMMIT, then the @@TRANCOUNT will decrement one which will cause an informational error to arise.

Additional Interesting Articles

Pearson Coefficient
SQL Server Database Recovery Mode
SQL Benchmarking - Clear Cache
SQL Create Procedure
SQL Check Existence of Table or Temp Table
PHP Send Mail

©2008 AndrewKimball.com