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)
 Exit DTS package in ActiveX Task script

Author  Topic 

DanielTang
Starting Member

10 Posts

Posted - 2004-01-06 : 10:11:16
Hi,

I am wondering whether anyone can help me on this one.

I created a DTS package basically transferring data in a text file to a table. However, the catch is sometimes the text file can be blank, ie 0 bytes in file size. So I used Filesystem object in the ActiveX script to check the file size. If the text file is blank, I want to exit the entire package and reporting success so that I will only receive email notification when the package has truelly failed.

So far I can only achieve terminating the package by reporting failure. Your help is very much appreciated.

Thanks in advance.

Daniel

VyasKN
SQL Server MVP & SQLTeam MVY

313 Posts

Posted - 2004-01-06 : 10:30:13
You could do this using an ActiveX script. You do not need a separate ActiveX script task for this. If you right click on the step that needs the file, select Workflow -> Workflow Properties. Go to Options tab. At the bottom of the box, check the box against 'Use ActiveX script'. Then click on the 'Properties' button next to it. This opens up an ActiveX script window. Type in the following code in there and Click OK, OK to come out.

Function Main()
'Omited the file system object code
If FSO.FileExists("SomeFile") Then
Main = DTSStepScriptResult_ExecuteTask 'Run this step
Else
Main = DTSStepScriptResult_DontExecuteTask 'Don't run this step
End If

End Function


--
HTH,
Vyas
http://vyaskn.tripod.com
Go to Top of Page

DanielTang
Starting Member

10 Posts

Posted - 2004-01-09 : 11:04:43
Thank you very much. It worked. Really appreciated your help and time.

Kind Regards

Daniel
Go to Top of Page
   

- Advertisement -