how do i do this

  • hi all,

    i have a table with 2 columns NAME,DATE

    and only one row

    i need to pass this DATE to a variable

    and create a new variable with the value of getdate() in it

    and then use these two parameters in a executesql task,

    any ideas how to go about doing this?

    i tried a lot of things,

    like playing around with the resultset , parameter mapping , no success,

    the thing is the DATE is a datetime datatype.........

  • hey,

    Not sure if I am understanding you correctly...

    First, you have a variable which stores the date you want to compare. For arguments sake, lets call this variable varCompareDate.

    Second, you have a ExecuteSQL task which would look something like "Select datediff(Whateveryourcompareneedstoreturn(Days,weeks,months etc), ?,getdate()) as DateDifference ".

    The question mark signifies the parameter that you are passing. In the parameter mapping section, map your parameter as the variable.

    TADA

    ~PD

  • thanks for the reply,

    here is the thing

    step 1 create a execute sql task and pass the date column from tablea as a variable (variablea)

    step2 create another execute sql task with just select getdate() statement as pass it as a output parameter (variableb)

    step3 i need to use both these variables in another execsql task with a condition like

    caldate between vriablea and variableb

    if i pass the variables as a type datetimestamp is it rite?

    and what about while using these variables as a input parameter do they need to be passed as datetimestamp? or nvarchar?

  • uhmmmm,

    Really stupid question here, if the date is on your table, why bother with the calculation in SSIS

    Surely you could just use getdate() as well as datediff as part of your SQL statement?

    The RDBMS will always be the right place for a calc like this.

    But yes, you are right, as long as they are date values

    ~PD

Viewing 4 posts - 1 through 4 (of 4 total)

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