Monday, July 28, 2008

SSIS - Mapping Parameter with Variables

Thanks to Rafael Salas, I able to solve my problem for using the variables in SSIS Execute SQL Task. If you having the same problem with me, here I attached some graphical guidelines on "How to use variable as Source Type in Execute SQL Task".

Wondering what is SSIS?
SSIS stand for SQL Server Integration Services. It's the new ETL tool for Microsoft SQL Server 2005


1.
Let's start with creating a new SSIS Project, define the data source. Rename the desire SSIS package name and double click to open. Now, define the connection manager by right click the area and select "New Connection From Data Source". Grab a "Execute SQL Task" from ToolBox


2.
Create a variable with string data types to store the sql query. If your query accept parameter(s), please create the parameter variable(s) too. For example, datefrom and dateto, and remember to key in the default values. Select your query variables, at the properties box, set the "evaluateAsExpr" to True.


3.
At the same properties box, select "Expression" and click on the "ellipsis" button. You will see a pop up windows for expression builder. Key in your sql statement and click on "Evaluate Expression" to check if the query parse successfully or not.


4.
Back to "Execute SQL Task editor", choose "Variable" at the SQLSourceType. Drop down the Source Variable and select your sql variables. Press "OK" button and you are done! Congratulation!

1 comment:

Unknown said...

Thanks! This is exactly what I needed. I wish everyone had images for instructions. Makes learning so much easier!!!