For loop container : Issue with date counters

  • I have a package:

    Where I have to get max date from a table ( max date is the latest date when the package was last run)

    Table :Date column in table of datatype : nvarchar and format 06/01/2014

    I am writing a simple query to pull this date : select max(date) from table and set this into variable ( type : string) using execute sql task

    execute sql task settings: Please see attached executetask.jpeg

    I have for loop where i need set the loop to run from latest date i.e @result variable to getdate()

    please see in the forloop.jpeg

    Unable to set the loop 🙁 can anyone please help?

  • You need it to loop for every day between MaxDate and GetDate()? Why not just return the number of days (between MaxDate and GetDate()) from your ExecSQL and use that as your loop counter?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Thanks it worked.:)

  • And why are you storing a date value as a character string? It should be stored as a date data type.

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

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