Sunday, October 12, 2008

Basic stored procedure transaction control


CREATE PROCEDURE Proc1

AS
-- Begin the transaction
BEGIN TRANSACTION
-- Do transaction operations

-- Check for any Error
If @@Error <> 0
-- Rollback the Transaction
ROLLBACK TRANSACTION

-- Commit the Transaction
COMMIT TRANSACTION

No comments: