views:

78

answers:

0

Hi,

I have a system that connect to SQL Server through ODBC. When I try to raiseerror from an IF...ELSE statement, it does not triggered the exception handling.

I have done some raise error testing at my side. Below is my finding:

  1. RaiseError did not triggered exception:

    CREATE PROC xxx AS IF 1=1 BEGIN raiserror (70000,15,15) END

  2. RaiseError triggered exception:

    CREATE PROC xxx AS IF 1=1 BEGIN raiserror (70000,15,15) raiserror (70000,15,15) END

    CREATE PROC xxx AS BEGIN raiserror (70000,15,15) END

Any idea why it does not work in IF...ELSE statement?

Thank you.

KC