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
  • 3
  • 3
LVL 39

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 39

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;

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

LVL 39

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS 2012 r2 - Parm Drop Down has Date/Time 12 31
always on switch back after failover 2 32
CPU high usage when update statistics 2 28
Can > be used for a Text field 6 39
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

775 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