by Joe Hunter
6. July 2010 11:22
Unfortunately up to this point I was using select 1/0 to force an error and jump to The CATCH block.
Thankfully I have started using this method instead
IF @ERR IS NOT NULL RAISERROR (@ERR, 16,1 )
Where 16 represents the SEVERITY. Using a value between 11 to 19 causes execution to jump to the CATCH block.
1 represents the STATE and is an arbitrary integer.
Reference:
http://msdn.microsoft.com/en-us/library/ms178592%28SQL.90%29.aspx