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?
Related
I do not have access to SQL Server Agent and would like to execute a stored procedure monthly from SQL Server Management Studio 14. I am trying to insert the syntax for a stored procedure that will ensure it will be executed anytime I log into the client.
How would I do this?
Using SSMS with linked servers. Have stored procedure in Express version that performs a table insert. When the stored procedure is run locally, the table insert works.
When I run an Agent Job executing the stored procedure from the linked Enterprise version, the table insert does not happen. Linked servers are set up properly - I have all permissions turned on for both target table and stored procedures.
My goal is to launch stored procedure from another DB (not MDS DB) when user commits Verion to start ETL process. For that in MDS DB i've added launching custom stored procedure in [mdm].[udpVersionSave].
But when i'm trying to commit Version in MDS Web interface, nothing happens - Version doesn't become commited. BTW, when i launch procedure from MDS DB - it's working.
My guess - the problem is in user\login access. But i try a lot combinations in giving access - nothing helped.
UPD.:
Code which launches stored procedure:
execute [AdventureWorksDW2012].[dbo].[sp__test_insert_data] #code = N'3';
Code of procedure sp__test_insert_data:
insert into AdventureWorksDW2012.dbo._test_insert_data(col_ver)
values (#code);
Procedure sp__test_insert_data works fine, when i'm launching it manually under sa.
Any ideas?
I'm running a stored procedure on server1 from my application. The stored procedure does a bunch of stuff and populate a table on server2 with the result from the procedure.
I'm using linked server to accomplish this.
When the stored procedure is done running the application continues and tries to do some manipulation of the result from the stored procedure.
My problem is that the results from the stored procedure has not been completely inserted into the tables yet, so the manipulation of the tables fails.
So my question is. Is it possible to ensure the insert into on the linked server is done synchronous? I would like to have the stored procedure not return until the tables on the linked server actually is done.
You can use an output parameter of the first procedure. When the table is create on the second server the output parameter value will be return to your application and indicates the operation is ready.
If the things are difficult then this you can try setting a different isolation level of your store procedure:
http://msdn.microsoft.com/en-us/library/ms173763.aspx
I found the reason for this strange behavior. There was a line of code in my stored procedure added during debug that did a select on a temporary mem table before the data in the same table was written to the linked server.
When the select statement was run, the control was given back to my application and at the same time the stored procedure continued running. I guess the stored procedure was running synchronously from the start.
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