Pls help..Loop Query to get Reports in Excel from a table

  • Hi All,

    I have a problem in getting reports in an excel sheet

    for each day from a table that contains

    SALES for EACH DAY from 2008-01-01 - till today.

    Every day there are approximately 8500 records.

    So my Full_Sales table contains 1,450,356 rows..(approx)

    Now, I have added a date column in the table to see which day what was sold...

    if you filter on day it will give you 8500 rows sold that day...

    there are total 162 days from so I want to give them 162 excel sheets from 1st jan --- till 10th june...

    I took one OLE db src (main SALES table)

    the conditional split with 162 date conditions

    then 162 Destination Excel sheets

    query is like this:

    --------select * from dbo.Historical_sales

    --------where sales_Date = '2008-06-08'

    ----------this result - 8545 rows (sales of one day)

    It's becoming hard to do ...Any help on this...

    Please reply ASAP..

    Regards

    Thanks in Advance.

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

  • Lemme get this straight...

    You want to create an excel workbook with 162 sheets. hmmmm, I actually feel sorry for whoever is going to read this report.

    Nonetheless, conceptually this should not be too difficult.

    You can create a select distinct date query, which you use in a FOR EACH ADO enumerator.

    The query should assign your date to a variable, which will be used to loop.

    In the loop, you can set your connectionstring, your query, and pretty much anything to create new sheets with the right data.

    Trust this helps

    ~PD

    Little footnote, why not consider creating a new workbook. Seriously, if I was the user that this report was intended for, I would systematically start ignoring the report, as it grows. 162 sheets is simply not pragmatic

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

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