begin try
begin tran
-- YOUR STATEMENTS HERE
commit tran
end try
begin catch
-- Display error
/*
SELECT
ERROR_NUMBER()
AS ErrorNumber,
ERROR_MESSAGE() AS ErrorMessage
;
*/
print('ERROR...');
print( 'Number: ' + cast(ERROR_NUMBER() as varchar(50)) );
print( 'Message: ' + cast(ERROR_MESSAGE() as varchar(max)));
-- Announce rollback
print('Rolling back!');
rollback tran
end catch
No comments:
Post a Comment