Import DTS package with T-SQL

  • I am asking, if anybody know how to import DTS pakage with T-SQL script? I wouldn't like to use Enterprise manager for this job.

  • Hi,

    You need to use DTSRUN utility, check BOL for more information.

    This can be called from within T-SQL using the xp_cmdshell extended stored procedure.

    Regards.

    JFB

  • With DTSRUN utility, I think, it is not possible to import DTS package from structured storage file to SQL Server. I have read BOL about DTSRUN utility and there is just explanation how to save package from SQL server to structured storage file.

    My task is to prepare import packages from structored storage file to SQL server without using EM.

    Regargds.

  • Hi,

    Yes you can execute structured storage file with DTSRUN utility.

    dtsrun /Ffilename /Npackage_name /Mpackage_password

    Regards

    Johnny

  • Are u the owner of the DTS package?

  • Thank for sintax and help.

    With suggested code I can excute DTS package from file, but I can't store it into SQL server.

    In the BOL under DTS programming topic, I found out the following code which in VB works and solve my problem:

    Dim package As New DTS.Package2

    package.LoadFromStorageFile "fileName", "", "", "", "PackageName"

    package.SaveToSQLServer "sQLServerName", "", "", DTSSQLStgFlag_UseTrustedConnection

    For T-SQL solution I used OLE Automation Objects stored procedures to execute this two VB lines.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply