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:
aram1] + "','" + @[User:
aram2] + "'"
And the Expression for your SQLStatement might look like this:
__________________________________________________________________________________________________There are no special teachers of virtue, because virtue is taught by the whole community. --Plato