Need to extract daily increments from a table using SQL statement with parameter

  • Hello,

    I am building ETL process in SSIS. I need to configure daily data extracts.

    I use OLE DB Source in Data Flow Sources.

    I created a variable which evaluates to the date I need.

    What I cannot figure out is how to put this variable into my SQL statement.

    Here is what I need:

    SELECT C1, C2, C3 from T1 where C3 >= @[User::MyVar]

    Is there better way in SS to do this task?

    Please help!

    Thanks,

    Pit

  • use this for your ole query

    SELECT C1, C2, C3 from T1 where C3 >= ?

    then click the parameters button and map your [User::MyVar] to the parameter.

    any time you use a ? it creates a place holder in the parameters section which you can map to variables. Now this is not always supported by the OLE provider, pervasive OLE for instance does not.

    Also the order in which the ? appear in the SQL statement is the order that the placeholders show up the params section.

  • Thank you! All works as I expect.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply