jjrr007
asked on
Wait 10 seconds in DTS package
Experts,
I am creating a DTS package that uses ActiveX scripts. What I need is for the DTS package to wait 10 seconds before it goes on to the next step in the DTS package.
Thanks a lot!
***You don't need to read below- unless you want further explanation
Using the code "main = DTSTaskExecResult_Success" will not work. I have to have the DTS package wait 10 seconds, before going on to the next step. Also, I prefer to have this in one DTS package.
I am creating a DTS package that uses ActiveX scripts. What I need is for the DTS package to wait 10 seconds before it goes on to the next step in the DTS package.
Thanks a lot!
***You don't need to read below- unless you want further explanation
Using the code "main = DTSTaskExecResult_Success"
You can also write some ActiveX code in an ActiveX Script Task.
ASKER
How do I incorporate the WAITFOR DELAY '0:00:10' into the ActiveX Control? Please advise.
I have raised the points, because of the difficulty.
Thanks!
I have raised the points, because of the difficulty.
Thanks!
>WAITFOR DELAY '0:00:10'
that is to be put into a SQL step.
In a ActiveX Script Step:
WScript.Sleep(10000)
that is to be put into a SQL step.
In a ActiveX Script Step:
WScript.Sleep(10000)
correct:
Set WshShell = WScript.CreateObject("WScr ipt.Shell" )
WshShell.Sleep(10000)
Set WshShell = WScript.CreateObject("WScr
WshShell.Sleep(10000)
ASKER
Is this for ten seconds?
Set WshShell = WScript.CreateObject("WScr ipt.Shell" )
WshShell.Sleep(10000)
Set WshShell = WScript.CreateObject("WScr
WshShell.Sleep(10000)
yes. the argument of Sleep is in milliseconds.
ASKER
Angel,
I tried that and got object required. I tried to declare it using Dim, I got WScript method not allowed. Please advise...
I tried that and got object required. I tried to declare it using Dim, I got WScript method not allowed. Please advise...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sleep is a method that belongs to the WScript object. WScript does not need to be instantiated:
<quote>
The WScript object is the root object of the Windows Script Host object model hierarchy. It never needs to be instantiated before invoking its properties and methods, and it is always available from any script file.
</quote>
So this will work in a VBS script:
WScript.Sleep 3000
MsgBox "Done!"
Having said it does not appear to be available in DTS.
<quote>
The WScript object is the root object of the Windows Script Host object model hierarchy. It never needs to be instantiated before invoking its properties and methods, and it is always available from any script file.
</quote>
So this will work in a VBS script:
WScript.Sleep 3000
MsgBox "Done!"
Having said it does not appear to be available in DTS.
For a crappy solution (just watch your CPU remain at 100% for 10 seconds) and providing you do not run at midnight, you can use something like this:
Dim Start
Start = Timer
Do While Start + 10 > Timer
Loop
Perhaps you should reconsider and use angelIII solution using WAITFOR DELAY or tell us why you need to wait 10 seconds.
Dim Start
Start = Timer
Do While Start + 10 > Timer
Loop
Perhaps you should reconsider and use angelIII solution using WAITFOR DELAY or tell us why you need to wait 10 seconds.
WAITFOR DELAY '0:00:10'
http://msdn.microsoft.com/library/en-us/tsqlref/ts_wa-wz_8ipg.asp?frame=true