Quantcast
Channel: Welcome To TechBrothersIT
Viewing all articles
Browse latest Browse all 1874

Passing Parameter/Parameters values to Sub Query in Execute SQL Task

$
0
0
Scenario:
We want to execute SQL Query in Execute SQL Task but before we do that we need to pass
parameter/parameters values to Inner Query or Sub Query.


Solution:
Lets say here is the query we want to run in Execute SQL Task


SELECT
id1
FROM
table1
WHERE id1 = (SELECT
id2
FROM
table2
WHERE col1 = @VarParamter1)
AND id3 = (SELECT
id4
FROM
table3
WHERE col2 = @VarParameter2)


Step1:
Create a new SSIS Package, After creating Package, create two variables as shown in picture.



Step2:
Drag Execute SQL Task and configure as show in figure


Step 3:
Write your query as show in picture and Press Ok.




Now your query will get the values from variables at execution time and run the query.

Viewing all articles
Browse latest Browse all 1874

Trending Articles