30.10.08

Sample Try - Catch in SQL 2005

begin tran Tran_DeleteAll
begin try
--Sample code
end try

begin catch
set @EMessage = @ProcedureName + ':' + ERROR_MESSAGE()
execute dbo.SPname @arg1,@arg2, 1, NULL, NULL, 2
rollback tran Tran_DeleteAll
end catch

No comments: