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. Web Development
  3. ASP.NET
  4. Execute SSIS package

Execute SSIS package

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasesql-serverasp-netdotnet
3 Posts 2 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.
  • A Offline
    A Offline
    alexfromto
    wrote on last edited by
    #1

    Hi. I have a SSIS package named TESTPACKAGE on the 2005 SQL Server. How I can exeucte it from ASP.NET? I found some articels that refer to Microsoft.SQLServer assembly but I use older .NET Framework version (1.1) and this assembly is not availabe for me in Visual Studio (2003). I read something about DTEXEC command. Can I use it in the Stored Procedure to run SSIS. I used this code in the Stored Procedure to run DTS package on the previsous/older SQL Server version. CREATE PROCEDURE dbo.exportData AS Exec master..xp_cmdshell 'DTSRUN /SMYSERVER /NTESTDTS /Umyaccess /Pmypassword' GO Thank you,

    S 1 Reply Last reply
    0
    • A alexfromto

      Hi. I have a SSIS package named TESTPACKAGE on the 2005 SQL Server. How I can exeucte it from ASP.NET? I found some articels that refer to Microsoft.SQLServer assembly but I use older .NET Framework version (1.1) and this assembly is not availabe for me in Visual Studio (2003). I read something about DTEXEC command. Can I use it in the Stored Procedure to run SSIS. I used this code in the Stored Procedure to run DTS package on the previsous/older SQL Server version. CREATE PROCEDURE dbo.exportData AS Exec master..xp_cmdshell 'DTSRUN /SMYSERVER /NTESTDTS /Umyaccess /Pmypassword' GO Thank you,

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Hope this will Help you. DECLARE @cmd VARCHAR(255) DECLARE @Wait INT DECLARE @result INT, @OLEResult INT DECLARE @ShellID INT SET @Wait = 0 SET @cmd = 'DTEXEC /sq "TestSSPSPackageName" /ser /Set \Package.Variables[User::varTargetName].Properties[Value];"c:\dtsxTest\Test2.txt"' -- create instance of OLE object EXECUTE @OLEResult = sp_OACreate 'WScript.Shell', @ShellID OUT IF @OLEResult <> 0 SELECT @result = @OLEResult IF @OLEResult <> 0 RAISERROR ('CreateObject %0X', 14, 1, @OLEResult) -- run package EXECUTE @OLEResult = sp_OAMethod @ShellID, 'Run', NULL, @cmd, 0, @Wait IF @OLEResult <> 0 SELECT @result = @OLEResult IF @OLEResult <> 0 RAISERROR ('Run %0X', 14, 1, @OLEResult) If @OLEResult <> 0 EXEC sp_OAGetErrorInfo @ShellID, @OLEResult -- drop object EXECUTE @OLEResult = sp_OADestroy @ShellID -- I think this will run an an asynchronous process.

      Regards, Satips.:rose:

      A 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        Hope this will Help you. DECLARE @cmd VARCHAR(255) DECLARE @Wait INT DECLARE @result INT, @OLEResult INT DECLARE @ShellID INT SET @Wait = 0 SET @cmd = 'DTEXEC /sq "TestSSPSPackageName" /ser /Set \Package.Variables[User::varTargetName].Properties[Value];"c:\dtsxTest\Test2.txt"' -- create instance of OLE object EXECUTE @OLEResult = sp_OACreate 'WScript.Shell', @ShellID OUT IF @OLEResult <> 0 SELECT @result = @OLEResult IF @OLEResult <> 0 RAISERROR ('CreateObject %0X', 14, 1, @OLEResult) -- run package EXECUTE @OLEResult = sp_OAMethod @ShellID, 'Run', NULL, @cmd, 0, @Wait IF @OLEResult <> 0 SELECT @result = @OLEResult IF @OLEResult <> 0 RAISERROR ('Run %0X', 14, 1, @OLEResult) If @OLEResult <> 0 EXEC sp_OAGetErrorInfo @ShellID, @OLEResult -- drop object EXECUTE @OLEResult = sp_OADestroy @ShellID -- I think this will run an an asynchronous process.

        Regards, Satips.:rose:

        A Offline
        A Offline
        alexfromto
        wrote on last edited by
        #3

        Thank you. As I understand this is a Stored Procedure, right? The other question I have is: can I just run this command separetly from my code: EXEC master..xp_cmdshell 'DTEXEC /sq "TEST_PACKAGE_NAME" /ser TEST_SERVER' Package doesn't accept any parameters. I created it when I was importing test.txt file and selected the option to create package on the fly. By the way how can I modify it if needed? Thanks a lot.

        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