views:

78

answers:

1

I read that SQL exceptions are treated as normal exceptions in managed SPs; I would like to know how is following scenario handled w.r.t to this.

  1. I have a normal t-SQL SP that calls a managed SP.
  2. managed SP throws exception due to some issue.
  3. How does normal T-SQL handle this.

I have not tried this scenario yet as I do not have SQL server on my current machine.

+1  A: 

It handles it like any other exception. In your TSQL code, you can wrap the call in a Try-Catch block.

For example:

Begin Try
    exec myManagedProc
End Try
Begin Catch
    print 'Error:' + error_message()
End Catch
BankZ