Home Forums SQL Server 2008 T-SQL (SS2K8) How to execute stored proc iin a loop for a date range RE: How to execute stored proc iin a loop for a date range

  • Thanks a lot Sean, Alan for responding. Especially Alan for taking your lunch time to write the code. I thought I provided enough information, but I guess not, sorry.

    Anyway, I think I will write a loop to have the big date range break into week/month range and insert into a table (like below), and then use the Identity column in that table to loop through to exec the stored procedure, and that should work.

    table

    ID (identity column) fromDate toDate

    1 01/01/2001 01/31/2001

    2 01/02/2001 02/28/2001