Parameterized OLEDB source query

user1765876 picture user1765876 · Aug 17, 2013 · Viewed 66k times · Source

I am creating an ETL in SSIS in which I which I want my data source to be a restricted query, like select * from table_name where id='Variable'. This variable is what I defined as User created variable.

I do not understand how I can have my source query interact with the SSIS scoped Variable.

The only present options are

  • Table
  • Table from variable
  • SQL Command
  • SQL command from a variable

What I want is to have a SQL statement having a variable as parameter

Answer

Edmund Schweppe picture Edmund Schweppe · Aug 17, 2013

Simple. Choose SQL command as the Data Access Mode. Enter your query with a question mark as a parameter placeholder. Then click the Parameters button and map your variable to Parameter0 in the Set Query Parameters dialog:

enter image description here

More information is available on MSDN.