[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Call StoredProcedure in SSIS

Posted on 2011-02-16
Medium Priority
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;

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

656 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