Link to home
Start Free TrialLog in
Avatar of jjrr007
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.

Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

You can also write some ActiveX code in an ActiveX Script Task.
Avatar of jjrr007
jjrr007

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!
>WAITFOR DELAY '0:00:10'
that is to be put into a SQL step.

In a ActiveX Script Step:
 WScript.Sleep(10000)
correct:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Sleep(10000)
Avatar of jjrr007

ASKER

Is this for ten seconds?

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Sleep(10000)
yes. the argument of Sleep is in milliseconds.
Avatar of jjrr007

ASKER

Angel,

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
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

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.