Executing a dtsx file from a stored procedure [duplicate] - sql-server-2005

This question already has answers here:
Execute SQL Server SSIS Package From Stored Procedure
(3 answers)
Closed 7 years ago.
I have a SSIS package in SQL Server 2005 that I want to execute from a stored procedure or trigger on a table insert or update.
How do I do it?
Thanks

A couple of options are:
Run the package by calling dtexec from the stored procedure
Write a CLR procedure that uses the SSIS object model to run the package
Create a SQL Agent job that runs the package and run the job using the sp_start_job stored procedure
See the following articles for further explanations
Running SSIS Package Programatically.
How to Call SSIS Package from the Stored Procedure
Execute SSIS Package from Stored Procedure with Parameters using DTEXEC Utility

You could create an unscheduled SQL Agent job that is configured to run the SSIS package. Then from your stored procedure or trigger, use sp_startjob to run the job.
sp_start_job: http://msdn.microsoft.com/en-us/library/ms186757.aspx

Related

SSIS deployed package execution using parameter at runtime

I have a package which is deployed using SQL server agent.
I am executing the SQL server agent by calling a stored procedure.
i have declared some variables inside the ssis package ,i want to use these variables as parameter in stored procedure.
any body Please help me.
Thanks in advance.
If you are allowed to use xp_cmdshell you could use dtexec to execute the package from a stored procedure . Passing a parameter can be done like this:
exec xp_cmdshell 'dtexec /f "c:demo\demo.dtsx" set \package.configurations[Configuration1].properties[Variable].value;int-002'
This is not a best practice. I would prefer to use my stored procedure to write my variables to a table first and then read from that table in SSIS with an Execute SQL statement as you can read here Populate an SSIS variable using a SQL statement

Execute SQL Task in TSQL

I have multiple SQL tasks that execute stored procedures. I intend to call these SQL tasks in some other stored procedure. How do I do this ?
In these SQL tasks, all I have is exec sp statement.All these SQL tasks need to start in a stored procedure only.
You can't call individual SSIS tasks, but you can call an SSIS package from a stored procedure. The procedure so is not totally straight-forwards and I won't put instructions here, as there are many sites which do so.
However, if all these tasks do is call an SP, why not just call the sp?

Running Stored Procedure in SSIS Child package, SQL Server 2012

I can run the child package on its own just fine. Package runs, stored procedure fires and updates a table as expected (stored procedure is aggregating some data and updating a second table with the results).
When I run it from its parent package the stored procedure appears to execute (I can see it in SQL Server profiler) however the table is not updated by the procedure. Other tasks within the child package run fine, both when the child package is run on its own and when run by parent.
This is running by SQL Server Agent job, deployed on SQL Server 2012. If I run the parent-child in Visual Studios, the stored procedure fires and the table is updated.
Seems that the stored procedure is not running when deployed. Any suggestions on how to troubleshoot this?

Execute a stored procedure using SQL Server 2008 in SSIS

I want to execute a stored procedure using a SSIS package.
The output that generates from this stored procedure will also a script, so I want to execute that script output too. Can I schedule this SSIS package using SQL Server Agent?
You can execute a stored procedure in an Execute SQL Task in SSIS and send the output to a variable. You can then read the content of that variable in a second Execute SQL Task.
And yes, you can schedule the package to execute via a SQL Server Agent job. See this link for details.
Cheers -

How to run a stored procedure automatically every day

How do I set up to run a stored procedure automatically every day in SQL Server 2008 R2?
Set up a SQL job http://msdn.microsoft.com/en-us/library/ms135739.aspx
You need to use the Job scheduler in the sql agent. Sql express doesn't include it so I just have a batch file run as a scheduled task to run it.
-James
Was discussed here:
Scheduled run of stored procedure on SQL server
Under SQL agent you need to go to the job scheduler and create a job that runs the stored proc. Once you have created the job you can create one or more schedules for the job. http://msdn.microsoft.com/en-us/library/ms135739.aspx