Solved

ssis - execute stored procedure

Posted on 2010-09-20
5
1,093 Views
Last Modified: 2013-11-10
I am trying to figure out how to execute a stored procedure from ssis. I have a working stored procedure. It has no parameters. I want to somehow execute it fro an ssis package. I found something at another site that says: Another option is to use expressions in the execute sql task editor.  You could create an expression for the SqlStatementSource property.  A simple example:"exec usp_SomeProc @somevar = '"+ @[User::strSomeVar]+"'"
but I could not figure out how to do that. I just want a simple EXEC dbo.usp_MAINTAIN_UDF_HISTORY.
0
Comment
Question by:qbjgqbjg
[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
5 Comments
 
LVL 16

Expert Comment

by:vdr1620
ID: 33720247
Try using

"
SET FMTONLY ON
SET NOCOUNT ON

exec usp_SomeProc @somevar = '"+ @[User::strSomeVar]+"'"
0
 

Author Comment

by:qbjgqbjg
ID: 33720657
I was already using SET NOCOUNT ON. Actually I think I may have it figured out. I used execute sql task . And the trick was for the sql command, I had to spell out execute. So the command was
EXECUTE dbo.usp_MAINTAIN_UDF_HISTORY. It worked. Now I am trying to figure out how to make it send me an email if it fails.
0
 
LVL 30

Accepted Solution

by:
Reza Rad earned 250 total points
ID: 33722188
if this is a data flow task, with ole db source,
set data access mode as "SQL Command"
and in sql command text, write like this:
exec mySP

instead of mySP write your stored procedure name,

if your stored procedure has any parameters you should use question mark as each of parameters. but if there is no parameter, just user exec mySP.


0
 
LVL 15

Assisted Solution

by:AmmarR
AmmarR earned 250 total points
ID: 33723310
Dear qbjgqbjg:

just use a simple Execute SQL Task and type in exec SP_name and it should work fine

check image below, i am using it to call a store procedure and its working fine.
exec-SP.png
0
 

Author Comment

by:qbjgqbjg
ID: 33725516
I had already tried it with EXEC  dbo.usp_MAINTAIN_UDF_HISTORY in the execute sql task. It did not work. It produced an error.  EXECUTE dbo.usp_MAINTAIN_UDF_HISTORY does work.
We are using sql server 2005. So maybe there is a difference.
execute-stored-procedure.docx
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

696 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