Click here to Skip to main content
15,894,086 members
Please Sign up or sign in to vote.
4.20/5 (2 votes)
See more:
Hi,

I would like to know is there anyway to tell SQL for running query till mentioned time frame (let's say for 5 min)?

If query not executed within given time frame, is there anyway to get error message or error code or something thru which i will come to know that query did not run?

Thanks in advance for help.

Anshul.
Posted
Comments
PIEBALDconsult 20-Nov-14 15:20pm    
You mean you want to set a time-out? That can probably be done in code. We would need to know what database system you're using to be more helpfull.
PhilLenoir 20-Nov-14 15:37pm    
If your DBMS/connection capability doesn't allow you to set a time-out but you are working in a multi-thread tool you could fire the query on a thread and kill the thread if it does not return in time.

You don't say what your DBMS is or what your programming toolset is.
AJain07 20-Nov-14 16:24pm    
Actually I am working on Sybase16 which is kind of same as SQL queries. We have stored procedure which is called by VB6 code.
I am looking is something can be by system level configuration. I would not like to jump in VB6 code.
Jörgen Andersson 20-Nov-14 17:18pm    
That's a bit of a problem then, you need to send AQT Cancel Task in a separate thread.
AJain07 20-Nov-14 17:22pm    
Is it not possible that i will attach some timeout with query while sending for execution?

For Sybase database you need to install Job Scheduler to be able to create schedule (job).

Have a look here: http://www.experts-exchange.com/Database/Sybase/Q_25357412.html[^].

Official documentation: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc20001.1570/pdf/jsusers.pdf[^]
 
Share this answer
 
Can you specify which database are you using?

For SQL Server you can find an answer here:

http://stackoverflow.com/questions/7653880/t-sql-stop-query-after-certain-time[^]
 
Share this answer
 
Hi Daniel,

I am using Sybase16
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900