create proc [dbo].[usp_SlowProc] as begin try set xact_abort on; -- Ensures rollback on some errors that bypass the try/catch mechanism raiserror('Waiting...', 0, 1) with nowait waitfor delay '00:00:10' raiserror('Completed successfully.', 0, 1) with nowait end try begin catch raiserror('Caught It.', 0, 1) with nowait -- Rollback, log the error. end catch
Then run it within SSMS/Toad:
and then cancel it (using SSMS/Toad) before it completes. The catch block does not run.
Assuming from this link that a user abort is the same as as what .NET does on a client timeout (the result is the same).