?
Solved

ssis - execute stored procedure

Posted on 2010-09-20
5
Medium Priority
?
1,095 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 1000 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 1000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.
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.
Suggested Courses

762 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