Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 breaking out of a recursive package

Author  Topic 

Maquis
Starting Member

25 Posts

Posted - 2003-12-09 : 14:17:51
I have a package that runs a process to import a file into a database, then move the file to an archive folder. It should run the same process no matter how many distinct files are in the original folder, so I have it call itself. I'd like it to break out of the loop once all the files in the original folder have been processed, without it erroring out. I tried using ActiveX to look for any remaining files, and if it doesn't find any to set Main = DTSStepExecResult_Failure. Then I have the workflow (on failure) set to go to an ActiveX task that sets Main = DTSTaskExecResult_Success. In the case of Main = DTSStepExecResult_Success, it calls itself. But it's still ending with an error...what am I missing?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-12-09 : 14:21:34
If it doesn't find any more files, then just have the ActiveX script go to End Function. Is the ActiveX script the one that is calling the DTS package recursively? If so, then check for files, if no files, then End Function.

Tara
Go to Top of Page

Maquis
Starting Member

25 Posts

Posted - 2003-12-09 : 14:26:38
No, I wasn't calling the package from ActiveX, I was using the Execute Package Task. That sounds easier...how do I call it from within ActiveX? Sorry if that's a dumb question, I'm rather a newbie with DTS...
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-12-09 : 15:45:40
DTS Packages can be run programmatically using DTSRun.exe. DTSRun.exe can be executed via WshShell.Run.

Tara
Go to Top of Page
   

- Advertisement -