Solved

Call StoredProcedure in SSIS

Posted on 2011-02-16
7
843 Views
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)
	Messages
	* 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

0
Comment
Question by:chokka
[X]
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
7 Comments
 
LVL 40

Expert Comment

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

EXEC stored_procedure par1,par2,....
0
 

Author Comment

by:chokka
ID: 34907438
This is written in Stored Procedure
declare @TempTable table  
(   
 NDC nvarchar(1000),   
 Qty nvarchar(1000)   
)  
  
Insert Into @TempTable (NDC,Qty)  
select    
     
   TR.NDC,     
   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  
  
  
select 
CAST(NDC AS VARCHAR) as NDC ,Sum(CONVERT(INT, Qty)) as Qty from  @TempTable  
Group By NDC

Open in new window

0
 
LVL 40

Expert Comment

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

EXEC stored_proc_name;

0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 40

Expert Comment

by:lcohan
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.
0
 
LVL 5

Expert Comment

by:jijeesh
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.
0
 

Accepted Solution

by:
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
0
 

Author Closing Comment

by:chokka
ID: 34949776
Thats the solution for my issue
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

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…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 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