Hi list,
In my T-SQL code, can I do
...
IF @@error <> 0
GOTO ERREXIT1
(OTHER CODE)
ERREXIT1:
PRINT ('Error inserting value to xx table')
GOTO ERREXIT2
(MORE CODE)
ERREXIT2:
PRINT('Fatal error: migration failed')
-- end of file
I'd like to have multiple places to do error handling since some of the errors won't affect subsequent code segments thus the execute can continue, while others are fatal and thus need to exit the whole file (go to errexit2).
Is that legal?
Thanks,
Elaine
MS Sql Server LazyDBA home page