Saturday, 31 July 2010

Error Handling- Use GOTO

-------------------
//processing
Select 1/0
if(@@Error<>0)
GOTO Err_Handler
-------------------
Err_Handler:
BEGIN
//Log error
//Rollback transaction
END
-------------------
SP_OUT:
BEGIN
// Finalize code
END
-------------------