• This does it and could be fairly easily converted to dynamic SQL if you needed it to be.

    SELECT t1.ID, t1.Name, ca.YrMnth, ca.Enrollment

    FROM #Table1 t1

    CROSS APPLY (

    SELECT '201401',[201401] UNION ALL

    SELECT '201402',[201402] UNION ALL

    SELECT '201403',[201403] UNION ALL

    SELECT '201404',[201404] UNION ALL

    SELECT '201405',[201405] UNION ALL

    SELECT '201406',[201406]

    ) ca (YrMnth,Enrollment)

    ;

    --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)