Link to home
Get AccessLog in
Avatar of jflanner

asked on

What is the SSIS equivilent of DTS.Package?

What is the SSIS equivilent of object DTS.Package?  My goal is to execute (from within a vbscript) an SSIS package.  In the "old" days, the code  
    Set Package = CreateObject("DTS.Package")
     Package.LoadFromSQLServer "(local)\adapt",,,256,,,,"MyPackage"
would do just that.  How do I do this in the new SSIS world?

I have tried running dtexec in  I tested my command in cmd.exe, it works when executed nativly.  But it will not work in  Any tips here?

My command is:

     dtexec /sql MyPackage

My package has been stored in SQL Server.
Avatar of SLaneDell

Hi jf,

You cany execute the package remotely, you have to do it on the same box as sql server due to licence issues, you can execute the package locally from the command prompt using: "dtexec package", but i dont think thats what your after, if you want to execute if from vb code you can call a stored proceedure from your app, that in turn executes the package. What you need to do is call this stored proceedure from your vb code :

xp_cmdshell dtexec package

make sure that 'dtexec' is in you path or else use its full path also make sure you use the full path for your 'package'

some more info here:
This appears to be the new object for SSIS:

set app = createObject("MSDTS.Application")

I found  this here:
Hi rboyd56,

These objects are only callable from vb.Net managed code within SSIS packages, the SQL Server 2005 licence does not allow them to be called externaly

The link that I sent dealt with calling SSIS packages from VB Script and that is the object that this user used. He had other problems so may be they were related to what you indicated.

If you are still sure you want to run the package from code you can use the following vb.Net managed code, you will have to add this reference to your project "Microsoft.SqlServer.ManagedDTS.DLL" default location"C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies" :

Dim app As New Application

Dim pkg As New Package

Dim pkgResults As DTSExecResult

pkgLocation = "C:\\Program Files\\Microsoft SQL Server\90\Samples\\Integration Services\\Package Samples\\CalculatedColumns Sample\\CalculatedColumns\\CalculatedColumns.dtsx"

pkg = app.LoadPackage(pkgLocation, Nothing, True)

pkgResults = pkg.Execute()



Be warned about any licencing implications thou !!, with the first method you will not need an sql server licence on the client machine
Thanks for the advice, but I am not doing this. I was just referencing a post I found.
Avatar of jflanner


O.K. folks.  Thanks for the input.  I'm almost there.

I am not concerned with licencing because the script runs on the SQL box.  It is coordinating a number of activities (some database related, some not).

I can create an MSDTS.Application where I used to create a DTS package.  The next line (which I have not altered from DTS days:

Package.LoadFromSQLServer "(local)\adapt",,,256,,,,"MyPackage"

fails due to wring number of parameters.  It seems the template of method LoadFromSQLServer has chenged, which is reasonable.  I went looking for doc on MSDTS.Application and I am having little luck.

Half the points go to the person who can walk me from creation of the Package handle (loaded from SQL server, not a saved .dtsx file) through the execution of that package.  I need thew SSIS equivilant of all three SQL 2000 DTS lines in the original post.

Hi Jf,
This is the prototype for the ssis LoadFromSQLServer method:

 LoadFromSqlServer ( _
      packagePath As String, _
      serverName As String, _
      serverUserName As String, _
      serverPassword As String, _
      events As IDTSEvents _

Here is an example of how you can use it:

Dim pkgResults As DTSExecResult
Dim app As New Application
 Dim pkg As Package = New Package()

 pkg = app.LoadFromSqlServer("\\PackageName", "yourserver", Nothing, Nothing, Nothing)

pkgResults = pkg.Execute()

Hope this helps,

Hi JF,

Just wondering how you got on with this, did it work for you ?

Hey Steve:

I got distracted and had to table this for a few days.  I'm getting a bit closer with your help and article  The complicating factor is I am maintaining VBScript, not VB .net.  (This is a large script.  I would hate to have to reengineer the entire thing.)

Any way - where I am at I have:

     Set Application = CreateObject("MSDTS.Application")
     Set Package = Application.LoadFromSqlServer("\\package","(local)\instance", Nothing,  
                                       Nothing,  Nothing)

This dies with error:

Microsoft VBScript runtime error: Type mismatch: 'Application.LoadFromSqlServer'

Any other ideas????
Avatar of SLaneDell

Link to home
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Hey Jf,

Just got a reference to show you that vbscript is incompatible with SSIS .Net objects :, but you can still use either of the methods that i have suggested above,

Hi JF,

Does this help, i think we have exausted most possibilities here,

Hey Steve:

I agree with you.  Form the Books Online you reference in the last post -

     The Integration Services application programming interfaces are incompatible with COM-based
     scripting languages such as VBScript.

is pretty damming.  I have developed a bat file - and call the bat file from a script as a tacticle measure.  That works - but I will not put it in production.  I will be converting the script to C# before it goes live.

Thanks for the help.