Call StoredProcedure in SSIS

Posted on 2011-02-16
Last Modified: 2012-05-11
SQL 2008 - SSIS

How to invoke a Stored Procedure inside the SSIS Package ?

I am getting an error, when i wrote the exec storedprocedure in the SSIS Package.
- Executing (Warning)
	* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)
	* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

Open in new window

Question by:chokka
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 40

Expert Comment

ID: 34907411
You can add a query task and call it like

EXEC stored_procedure par1,par2,....

Author Comment

ID: 34907438
This is written in Stored Procedure
declare @TempTable table  
 NDC nvarchar(1000),   
 Qty nvarchar(1000)   
Insert Into @TempTable (NDC,Qty)  
   Sum(TR.[Dispensed Qty]) as Qty  
from  TransactionReport TR      
Group By    TR.NDC  
Insert Into @TempTable (NDC,Qty)  
select BR.NDC,BR.Qty  from BalanceReport BR  
CAST(NDC AS VARCHAR) as NDC ,Sum(CONVERT(INT, Qty)) as Qty from  @TempTable  
Group By NDC

Open in new window

LVL 40

Expert Comment

ID: 34907477
Ok not sure about its name but the command to call it in a Query task would be:

EXEC stored_proc_name;

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

LVL 40

Expert Comment

ID: 34907516
one aspect though because you have temp table inside the SP...check your connection string (Manager) and make sure you run the SSIS task on a connection that is on the same server and temp table must go in temp db on the server where SSIS is running. If you need to do it on remote SQL servers use a DECLARE TABLE @temptable instead. A variable table does not care where you run it as it is not directly tied into tempdb database but if the data set in temp table is huge you may have performance issues.

Hope this helps.

Expert Comment

ID: 34908183
In SSIS NVARCHAR is of type DT-WSTR and VARCHAR is of type DT-STR. So ensure proper casting before you pass the value.

Either you can perform datatype conversion in SSIS or SQL Procedure.

Accepted Solution

chokka earned 0 total points
ID: 34919536
Issue is different.

If you watch the query has 3 execution affected rows.

In SSIS, we cant run a stored procedure or 3 different execution statements.

We can have a SSIS with only one row affected statement

Author Closing Comment

ID: 34949776
Thats the solution for my issue

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question