June 6, 2005 at 9:20 am
When doing errorhandling in a stored procedure typically we store the value of @@error and return the value at the end of the sp. Casting errors of the same severity as say foreign key error seem to cease execution of the stored procedure without progressing to the end of the sp.
e.g. delete from mytable will progress onto the next row of the sp even though a foreign key error has occurred as you would expect.
this ceases execution straight away -
declare @x int
set @x = '1.1'
nothing is returned from the stored procedure! Can anyone explain this behaviour?
Phil Nicholas
June 6, 2005 at 9:42 am
For errors like data integerity errors and schema errors sql statement will be terminated.
http://www.sommarskog.se/error-handling-I.html
Work around is use output paramenter and set it to success at the end of the procedure. So when the statement terminates it will not return success.
Regards,
gova
June 6, 2005 at 9:54 am
Thanks thats a really useful article, not what i wanted to hear though!
Phil Nicholas
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply