Query to write for Report

  • Not able to get the things working. Might be someone can help

    My input table looks like

    IDLogical_DrivesFree_SpaceSQL_ServerDate

    0C 21573 N-W-4 2010-06-21 00:00:00.000

    1D 60863 N-W-42010-06-21 00:00:00.000

    2E 90333 N-W-42010-06-21 00:00:00.000

    3C 33828 N-V-52010-06-21 00:00:00.000

    4E 87376 N-V-52010-06-21 00:00:00.000

    5C 21573 N-W-42010-06-22 00:00:00.000

    6D 60863 N-W-42010-06-22 00:00:00.000

    7E 90333 N-W-42010-06-22 00:00:00.000

    I would like to view this data in Excel sheet and I can only use SSIS (huh!! SSRS would have made by job easier but..)

    The report should look like

    N-W-4

    2010-06-21 00:00:00.000 2010-06-22 00:00:00.000

    c 21573 21573

    d 60863 60863

    e 60863 90333

    N-V-5

    date date

    c

    d

    How do I write my query to get my report this way

  • khushbu (8/17/2010)


    Not able to get the things working. Might be someone can help

    My input table looks like

    IDLogical_DrivesFree_SpaceSQL_ServerDate

    0C 21573 N-W-4 2010-06-21 00:00:00.000

    1D 60863 N-W-42010-06-21 00:00:00.000

    2E 90333 N-W-42010-06-21 00:00:00.000

    3C 33828 N-V-52010-06-21 00:00:00.000

    4E 87376 N-V-52010-06-21 00:00:00.000

    5C 21573 N-W-42010-06-22 00:00:00.000

    6D 60863 N-W-42010-06-22 00:00:00.000

    7E 90333 N-W-42010-06-22 00:00:00.000

    I would like to view this data in Excel sheet and I can only use SSIS (huh!! SSRS would have made by job easier but..)

    The report should look like

    N-W-4

    2010-06-21 00:00:00.000 2010-06-22 00:00:00.000

    c 21573 21573

    d 60863 60863

    e 60863 90333

    N-V-5

    date date

    c

    d

    How do I write my query to get my report this way

    The easiest thing to do would be to just load your data into the Excel spreadsheet and use a "Pivot Table" to rotate the data the way you want it. If you really want to do it in SQL Server first, then read the article at the first link in my signature line below for how to acutally post data to get the best (or any, for that matter) help.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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