Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 force stored procedure to timeout

Author  Topic 

tpiazza55
Posting Yak Master

162 Posts

Posted - 2010-09-29 : 16:38:16
Is there a way to force a stored procedure timeout?

I need this to happen to test an error handling method

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-29 : 16:42:50
For this test, will you be executing it via the application or from SSMS?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tpiazza55
Posting Yak Master

162 Posts

Posted - 2010-09-29 : 16:55:16
the application calls thestored procedures. its a general function to get the recordset so i cant set a commandtimeout because it timeout the other queries that need to run first. need the particular sp itself to timeout somehow.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-29 : 18:05:10
Add WAITFOR to the stored procedures you want to test. Have it WAITFOR a value that is higher than commandtimeout.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

mstorms
Starting Member

1 Post

Posted - 2013-11-07 : 17:25:10
I need to do the same thing (i.e. force a timeout to test some error handling code), but from SSMS. I've tried going into Tools > Options > Query Execution and setting a timeout of 3 seconds. Then I tred running a query with WAITFOR DELAY '000:00:10'. But the query doesn't timeout. What else do I need to do?

Mike
Go to Top of Page
   

- Advertisement -