Need expressions of for loop

  • hi All,

    I need to execute some tasks in Loop.

    The loop should continuos based on Date

    Here

    ->intialization is Getdate() of SQL server.

    ->Eval expression is also Comparison of IntialGetDate with the Getdate()of after Execution some tasks.

    IF both dates[no need of time] are equal loop continuos

    ->no increment

    the below one i used in eval expression but it throws error.

    "@[User::LopVariable]"=="@[User::IterlopVariable]"

    Suppose if the SSIS packege starts its execution at 2011/01/29 00:30:15

    then it should continuosly execute the tasks inside loop between 2011/01/29 00:30:15 and 20011/01/29 23:59:59

    I have taken one Packagevarible[initdate] of string for InitialGetdate

    and another Packagevarible[iterationdate] of string after execting some tasks inside loop.

    I am assigning values to above variables by execut SQL Task control with following command by result set property

    Select Convert(varchar(10),getdate(),103)

    I am getting errors while comparison of the two strings in eval expression in For loop..[initdate vs iterationdate]

    Can i execute For loop with only Eval expression.

    How to compare two string in for loop expression

    Please help me step by step...to proceed ...

    and provide me the expressions...

    Thanks in Advance..

  • Try removing the double quotes from your expression:

    @[User::LopVariable]==@[User::IterlopVariable]

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Thanks...i got it...

    I had changed the package variables from String to int

    and

    used the following query to assign sql server date to the package variables

    Declare @mon INT,@day INT

    SET @mon=DatePART(Month,GETDATE())

    SET @day=DatePART(Day,GETDATE())

    Select CAST(

    CAST(DatePART(yy,GETDATE()) AS VArchar(4))

    + CASE WHEN @mon<10 THEN '0'+CAST(@mon as VARCHAr(2)) ELSE CAST(@mon as VARCHAr(2)) END

    + CASE WHEN @day<10 THEN '0'+CAST(@day as VARCHAr(2)) ELSE CAST(@day as VARCHAr(2)) END

    AS INT)as dt

    Ditrctly compare the values in Evalexpression..

    @[User::IterationVar]<= @[User::LopVariable]

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

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