How to use a variable in sql query

  • I have populated a value in a variable but how can I use that variable in a query in Ole db destination? Here there are no parameters to set button.

    Thanks.

  • Hi Ramadesai108,

    If you want to store the value of your variable inside a table via an OLE DB Destination, one method is to use a Derived Column Transformation to add a column, containing the variable value, to the rows in your Data Flow Task.

    Hope this helps,

    Andy

    Andy Leonard, Chief Data Engineer, Enterprise Data & Analytics

  • Hello Andy,

    Thanks for your response. There must be a way to use the variable inside a query instead of storing it in a table.

    Thanks.

  • What is the problem you are trying to solve?

    Andy

    Andy Leonard, Chief Data Engineer, Enterprise Data & Analytics

  • I am trying to fetch a subset of data from one database, insert that data into staging table. Then take the new records from staging and insert into the destination table as fastload. Then take the records that are updates from staging and update the destination table. But for updates I wanted to use destination ole rather than sql task. One of the issue I am facing is the date datatype. When creating the variable I use DateTime, but when setting the parameter for SQL task, there is no Datetime so I use Date. But looks are they are not compatible.

    Thanks.

  • Try the DT_DBTimeStamp data type.

    Hope this helps,

    Andy

    Andy Leonard, Chief Data Engineer, Enterprise Data & Analytics

  • DT_DBTimeStamp is not avialable for Parameter Mapping.

    THanks.

  • Please email the package to me: andy.leonard@gmail.com. I'm missing something.

    :{>

    Andy Leonard, Chief Data Engineer, Enterprise Data & Analytics

Viewing 8 posts - 1 through 7 (of 7 total)

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