BEGIN
TRANSACTION TransactionName
BEGIN
TRY
PRINT 'Do work here'
END
TRY
BEGIN
CATCH
PRINT 'ERROR: ' + CAST(ERROR_MESSAGE() AS VARCHAR(1000))
PRINT 'Aborting and Rolling Back'
ROLLBACK TRANSACTION TransactionName
END
CATCH;
-- <- Use this section for unit testing -> --
PRINT
'Aborting and Rolling Back'
ROLLBACK
TRANSACTION TransactionName
-- <- Use this section to commit your changes -> --
--PRINT 'Commiting Transaction'
--COMMIT TRANSACTION TransactionName
posted on Friday, March 30, 2007 11:13 AM