Search This Blog & Web

Monday, March 30, 2009

Transaction Handling for SQL Server Procedures

--------------- SQL Server 2000

Begin Transaction
------- Paste your code here
------- On every Insert or Update write
if @@Error > 0
GoTo ErrorPoint

Commit Transaction

ErrorPoint: --- this is go to defination
Rollback Transaction

--------------- SQL Server 2005
Begin Try
Begin Transaction
----------- Paste your code here
Commit Transaction
End Try
Begin Catch
Rollback Transaction
End Catch
Post a Comment