March 22, 2004 at 6:08 pm
I am running a Execute SQL task on an Access database and on success, I am running an ActiveX script task to compact the Access database. My issue is that the .mdb needs a wait few seconds to close before it can be compacted so I don't get an error that the database is opened exclusively by myself.
How can I tell the DTS to wait 10 seconds before running the activeX task?
March 22, 2004 at 7:46 pm
Use the time function with DATEADD to set a time to wait and use a WHILE to keep looping until time is reached. The downside is the CPU cycles will be used. You could also create a connection to the SQL Sever in the code after you disconnect step and run a WAITFOR DELAY or WAITFOR TIME, se WAITFOR in SQL BOL.
March 24, 2004 at 12:07 am
You might also try using the timer function in your activex vbscript code and just loop until you reach a constant value of ticks set in the script.
Peter Evans (__PETER Peter_)
March 24, 2004 at 8:15 am
The only issue with that is it will create a high CPU utilization than does connection to a SQL Server and doing a WAITFOR (even to the local server, works similar to Sleep in C++).
March 24, 2004 at 8:18 am
I've ran into the same problem and just inserted an ActiveX Script Task between the 2 steps containing the following code which will wait 10 seconds before continuing.
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
a = Timer
While Timer < a + 10
Wend
Main = DTSTaskExecResult_Success
End Function
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply