1
Reply

"begin catch" and "end catch"

George George

George George

Jan 19 2009 8:39 AM
2.7k

Hello everyone,

I am not sure my following code must be put between "begin catch" and "end catch"? Or they could be in any where in a store procedure -- e.g. outside "begin catch" and "end catch"?

[Code]
IF @@ERROR <> 0
BEGIN
 IF @@TRANCOUNT > 0
  ROLLBACK
 DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int
 SELECT @ErrMsg = ERROR_MESSAGE(),
      @ErrSeverity = ERROR_SEVERITY()
 RAISERROR(@ErrMsg, @ErrSeverity, 1)
END -- end of IF @@ERROR <> 0
[Code]

thanks in advance,
George


Answers (1)