Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS- Call to Stored Procedure


SSIS- Call to Stored Procedure

Author
Message
greeshatu
greeshatu
SSC Rookie
SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)

Group: General Forum Members
Points: 38 Visits: 138
Hi

I have scenario where I need to Call an Storeprocedure in SQL task

Eg: Procedure Name Like Usp_ABCDEF 'Param1',Param2'

Part of Stored Procedure name is coming from Varible

Eg: @Entity='DEF' [@Entity is a variable for the task]

How to pass it in SQL statement of SQL Task

I have done like EXEC ('Usp_ABC'+? ? ?)

But Iam getting an error .

Kindly request to help me .
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8231 Visits: 14368
greeshatu (3/29/2013)
Hi

I have scenario where I need to Call an Storeprocedure in SQL task

Eg: Procedure Name Like Usp_ABCDEF 'Param1',Param2'

Part of Stored Procedure name is coming from Varible

Eg: @Entity='DEF' [@Entity is a variable for the task]

How to pass it in SQL statement of SQL Task

I have done like EXEC ('Usp_ABC'+? ? ?)

But Iam getting an error .

Kindly request to help me .


The ? mark denotes a parameter in your statement which when it comes to executing a SQL statement has a little more meaning than just a simple placeholder for a string substitution. Instead of using parameters you'll need to build your SQL statement in an SSIS Variable using an SSIS Expression and then map that Variable to the SQLStatement property of your Execute SQL Task.

The Expression for your new Variable (named as @NewVariable for discussion purposes) might look like this, where Entity, Param1 and Param2 are also SSIS Variables in your SSIS Package:

"Usp_ABC" + @[User::Entity] + "'" + @[User:Tonguearam1] + "','" + @[User:Tonguearam2] + "'"

And the Expression for your SQLStatement might look like this:

@[User::NewVariable]

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search