SSIS 2012 Parameter

Hello,

I am using a OLE DB source task and i want to setup a parameter in the select statement. Is this possible and how would this be done. I know you can pass a parameter in the where clause like:

select id, lname, fname, startDate, endDate from Employee where id = ?

how would i set startDate and endDate as parameters as i would like to be able to change these parameters when running the package. I would like to set dates in the select statement as parameters like how you would in the where clause.

Select id, lname, fname, ? startDate, ? endDate, from employee where id = ?

I would like to be able to change these dates without having to go in to the package and hard code it back in there and then deploy.

The package uses a OLE DB source to Flatfile Destination.


  • Edited by Emanlee00 Friday, June 19, 2015 3:31 PM
June 19th, 2015 2:38pm

Hi Emanlee00,

If I understand correctly, you want to use dynamic column in the OLE DB Source query.

Based on my research, we cannot pass dynamic column in the OLE DB Source query using SQL command Data Access Model. To achieve your goal, we can create variables with the column name of OLE DB Source, then create another variable to write the OLE DB Source query. For more details, please refer to the following steps:

  1. Create a variable named Col1 with the column name of OLE DB Source.
  2. Create another variable to build the your query with SSIS expression:
    "select id, lname, fname," +  @[User::Col1] +" from Employee"
  3. In OLEDB Source Editor choose Data Access Model SQL command from variable. Set variable name to the variable you created in the previous step.


If there are any other questions, please feel free to ask.

Thanks,
Katherine Xiong

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 1:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics