In this instance I am referring to ActiveX script as used in the Active Script tasks within
a DTS package. The examples only cover VBScript as I don't know JScript.
Basically you need to create the package object, and load the relevent package into that object.
You can then use the Execute method on that object.
Set oPKG = CreateObject("DTS.Package")
oPKG.LoadFromSQLServer ".", , , 256, , , , "Package Name"
Set oPKG = Nothing
The example above simply loads a package from the local server, using trusted security, called Package Name.
You can also load File or Repository packages using oPKG.LoadFromStorageFile and oPKG.LoadFromRepository respectively. These
are fully documented in SQL Server Books Online, as is the full syntax of LoadFromSQLServer.
For a more useful application of this method see my Import all files in a directory article and sample.
The DTSRUN command line utility is supplied with SQL Server (\mssql7\binn\dtsrun.exe) and is filly documented in
SQL Server Books Online. I will not duplicate that information here but concentrate more on the uses that can be made of it.
You can run any package type by supplying the relevent parameters in the command line string.
Thus any method of executing an operating-system command shell can be used to execute DTSRUN and subsequently any package.
By using the xp_cmdshell extended stored procedure you can execute a DTS package from within a SQL script or stored procedure.
You can also call it from a batch file or even another program via the relevent command shell syntax.
This is perhaps the most useful and flexible method of executing DTS Packages, but it does unfortunately have one disadvantage.
There is no easy way to debug errors. If the error is in the package then you can use the package Error File
(Set under the Package Properties General tab), but the utility itself returns no error information except
from that visible when run from a command prompt. This is of course limited to the development stage.
Enterprise Manager - Manual
This is obviously the simplest method, and also the least flexible.
Within Enterprise Manager, navigate to the relevent package type folder, under Data Transformation Services, right-click the package, then click Execute Package.