December 1, 2002 at 10:00 pm
Hi,
How do you handle exceptions in an SQL Server pre-compiled object (e.g- trigger and stored procedure)
Regards,
Abhijit
December 1, 2002 at 10:21 pm
If it's an error I know is going to terminate the batch, I'll test for it before-hand if at possible. Otherwise, I'll check @@ERROR and take appropriate action, including rolling back a transaction, if necessary.
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
December 2, 2002 at 4:50 am
Yeah you really have to predict what could happen and test if that condition would be met then handle your way. Otherwise it will end the process that cause the error with a built in message.
December 3, 2002 at 9:59 pm
Keep in mind that most errors are simple trapped and reported in the @@ERROR variable, not necessarily cancelling the current procedure. YOu are free to check @@ERROR and take what ever action is appropriate.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply