giammin

Sql query Template with error handling

Aug 9th, 2013
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.28 KB | None | 0 0
  1. BEGIN TRAN
  2. BEGIN TRY
  3.     /* PUT USEFUL STUFF HERE */
  4.    
  5.     /* WHEN YOU FEEL SAFE, CHANGE THIS TO COMMIT TRAN */
  6.     ROLLBACK TRAN
  7. END TRY
  8. BEGIN CATCH        
  9.     ROLLBACK TRAN
  10.     PRINT 'AT LINE: ' + CAST(ERROR_LINE() AS varchar(10));
  11.     PRINT ERROR_MESSAGE();
  12. END CATCH
Advertisement
Add Comment
Please, Sign In to add comment