DTS Version

  • How to load the lastest version of DTS. I am using the following script to load the package but it fails if the pacakge has more then 1 version. I do not know as which property will get me the lastest version which I can specify in LoadFromStorageFile.

    Set oPackage1 = CreateObject("DTS.Package2")         

    oPackage1.LoadFromStorageFile Filename,"","","",""

    oPackage1.SaveToSQLServer SQlServer,UserId ,Password

     


    Kindest Regards,

    Amit Lohia

  • Read up in BOL about DTSRunUI.  This will talk about the different parameters that you can configure for this...



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • my question is how can I get the lastest version Id using TSQL or vbs.

    In VBS when I use Set objPkgInfos = CreateObject("DTS.SavedPackageInfos"). I get error of cannot create object.

    Anyone know about this ??

     


    Kindest Regards,

    Amit Lohia

  • Use this vbs

     

    SQlServer=WScript.Arguments(0)

    Filename=WScript.Arguments(1)

    const TrustedConnection = 256

    dim version1

    Set oPackage1 = CreateObject("DTS.Package2")

     

    oPackage1.LoadFromStorageFile Filename,"","","",""

    oPackage1.SaveToSQLServer SQlServer, , , TrustedConnection

    Set oPackage1 = Nothing

     

     

  • Thanks for the reply I have solved the version problem by changing the scripts

    SQlServer=WScript.Arguments(0)

    Filename=WScript.Arguments(1)

    UserId=WScript.Arguments(2)

    Password=WScript.Arguments(3)

    const TrustedConnection = 256

    Dim PackageDate

    Dim VersionId

    Dim PackageId

    Set oPackage1 = CreateObject("DTS.Package2")

    For each PackageInfo in oPackage1.GetSavedPackageInfos(Filename)

     If PackageDate < PackageInfo.VersionSaveDate  Then

      PackageDate = PackageInfo.VersionSaveDate

      VersionId = PackageInfo.VersionId

      PackageId = PackageInfo.PackageId

     End If

    Next

    oPackage1.LoadFromStorageFile Filename,"",PackageId,VersionId,""

    oPackage1.SaveToSQLServer SQlServer,UserId ,Password

    Set oPackage1 = Nothing


    Kindest Regards,

    Amit Lohia

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

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