SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 force stored procedure to timeout
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tpiazza55
Posting Yak Master

162 Posts

Posted - 09/29/2010 :  16:38:16  Show Profile  Reply with Quote
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

USA
37129 Posts

Posted - 09/29/2010 :  16:42:50  Show Profile  Visit tkizer's Homepage  Reply with Quote
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 - 09/29/2010 :  16:55:16  Show Profile  Reply with Quote
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

USA
37129 Posts

Posted - 09/29/2010 :  18:05:10  Show Profile  Visit tkizer's Homepage  Reply with Quote
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 Posts

Posted - 11/07/2013 :  17:25:10  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000