Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. executing a DTS from a stored proc....

executing a DTS from a stored proc....

Scheduled Pinned Locked Moved Database
toolstutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thesisus
    wrote on last edited by
    #1

    I have a stituation where I need to be able to run a DTS package to clean up some data. The only thing that changes in the DTS is one number. Unable to find away to pass this variable to the package directly I made a table and a stored proc that updates this tables value. Then I run the DTS pack. This all works fine but is manual. If I could fire the DTS from the stored proc then this application would rebuild it's corrupt data on the fly. But I can't for the life of me figure out how to fire the DTS without clicking on the lil green arrow, running from a cmd prompt or using windows run utility. Any ideas? ----------------------------------------- Real programmers don't document. If it was hard to write, it should be hard to understand.

    N 1 Reply Last reply
    0
    • T Thesisus

      I have a stituation where I need to be able to run a DTS package to clean up some data. The only thing that changes in the DTS is one number. Unable to find away to pass this variable to the package directly I made a table and a stored proc that updates this tables value. Then I run the DTS pack. This all works fine but is manual. If I could fire the DTS from the stored proc then this application would rebuild it's corrupt data on the fly. But I can't for the life of me figure out how to fire the DTS without clicking on the lil green arrow, running from a cmd prompt or using windows run utility. Any ideas? ----------------------------------------- Real programmers don't document. If it was hard to write, it should be hard to understand.

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      You should be able to run the DTS package from code, so lets say that your recordset returns 0 which means you would need to fire your DTS package to rebuild the data you could do something like this, (at least in VB6 :omg: )

      '=========================================================
      'Include Microsoft DTSPackage Object Library in References

      Dim dts As DTS.ExecutePackageTask
      dts.PackageName = "[YourPackageNameHere]"
      dts.RepositoryDatabaseName = "[YourDatabaseNameHere]"
      dts.ServerUserName = "[YourUserNameHere]"
      dts.ServerPassword = "[YourPasswordHere]"
      dts.Execute(Package, PackageEvents, PackageLog, DTSTaskExecResult_Success)

      HTH Nick Parker


      T 1 Reply Last reply
      0
      • N Nick Parker

        You should be able to run the DTS package from code, so lets say that your recordset returns 0 which means you would need to fire your DTS package to rebuild the data you could do something like this, (at least in VB6 :omg: )

        '=========================================================
        'Include Microsoft DTSPackage Object Library in References

        Dim dts As DTS.ExecutePackageTask
        dts.PackageName = "[YourPackageNameHere]"
        dts.RepositoryDatabaseName = "[YourDatabaseNameHere]"
        dts.ServerUserName = "[YourUserNameHere]"
        dts.ServerPassword = "[YourPasswordHere]"
        dts.Execute(Package, PackageEvents, PackageLog, DTSTaskExecResult_Success)

        HTH Nick Parker


        T Offline
        T Offline
        Thesisus
        wrote on last edited by
        #3

        Thanks, but this woundn't work from within the stored proc. I think this is the perverbial dead-end; where I need to look back and see how I got in this situation. The problem is probably my implimentation. The DTS takes approx. 4-5 hours to run, so anything through IIS is out. Thanks again though. :) Real programmers don't document. If it was hard to write, it should be hard to understand.

        N 1 Reply Last reply
        0
        • T Thesisus

          Thanks, but this woundn't work from within the stored proc. I think this is the perverbial dead-end; where I need to look back and see how I got in this situation. The problem is probably my implimentation. The DTS takes approx. 4-5 hours to run, so anything through IIS is out. Thanks again though. :) Real programmers don't document. If it was hard to write, it should be hard to understand.

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          pmenefee wrote: Thanks, but this woundn't work from within the stored proc. I think this is the perverbial dead-end; Actually, if you have your DTS designated to a job then I think what you should check into is sp_start_job. This should work from within a stored procedure. :) HTH Nick Parker


          K 1 Reply Last reply
          0
          • N Nick Parker

            pmenefee wrote: Thanks, but this woundn't work from within the stored proc. I think this is the perverbial dead-end; Actually, if you have your DTS designated to a job then I think what you should check into is sp_start_job. This should work from within a stored procedure. :) HTH Nick Parker


            K Offline
            K Offline
            klateno
            wrote on last edited by
            #5

            You can use: xp_cmdshell and dts run utility to execute DTS package from store procedure. You can create statement like exec master..xp_cmdshell 'dtsrun /Uuser_name /Ppassword /Sserver_name /Npackage_name /Mpackage_password' Please read more about xp_cmdshell & dtsrun from SQL Server Books Online. Regards

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups