June 2, 2016 at 3:18 pm
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?
June 2, 2016 at 3:49 pm
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?
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
June 2, 2016 at 4:06 pm
Thanks it worked.:)
June 2, 2016 at 4:57 pm
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