Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Call StoredProcedure in SSIS

Posted on 2011-02-16
7
Medium Priority
?
873 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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

810 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