I am executing the following query in a stored procedure, transferring one year's transactions from one table to another:
insert into
table2
select
*
from
table1
where
dates between '20110101' and 20111231'
When I use VB6 to call the stored procedure, it times out.
I've tried to set the QueryTimeout
property on my RDO Connection to five seconds like so:
RdoConn.QueryTimeout = 5000
But it's still timing out.
How can I prevent the execution of the query from timing out?
Your two options (without changing the database schema) are:
1) Increase your timeout time eg:
2) If your query is taking longer than 30 seconds to execute then you should probably try breaking down your select statement into smaller parts:
As mentioned though you should also look at indexes and data types in your database to improve performance
If you use an Ado connection you can use the following code
and then use this connection to execute your query.
How much time does your query take to run without issue?
Update:
Using RdoConnection, you can try to set event the LoginTimeout
or as pointed out by Oleg Dok