• Complete stab in the dark, that what you are looking at is some kind of table with 5 rows and based on what can be seen, and assuming it is indeed only one table: Lots of if buts and maybes here, which is why it is important to provide the detail requested; how about:

    CREATE TABLE dbo.MyHomework

    (

    MyDateCol date

    , N1 INT

    , N2 INT

    , N3 INT

    , N4 INT

    , N5 INT

    , N6 INT

    , N7 INT

    , CONSTRAINT PK_MyHW PRIMARY KEY CLUSTERED (MyDateCol) ON [PRIMARY]

    );

    INSERT INTO dbo.MyHomework (MyDateCol, N1, N2, N3, N4, N5, N6, N7)

    VALUES

    ('04-07-2002', 5, 32, 34, 39, 49, 38, 8),

    ('06-07-2002', 21, 10, 33, 40, 20, 44, 34),

    ('08-07-2002', 10, 36, 48, 35, 30, 38, 12);

    SELECT MyDateCol, Numb, MyCol

    FROM dbo.MyHomework

    UNPIVOT (

    MyCol FOR Numb IN (

    N1, N2, N3, N4, N5, N6, N7

    )

    ) unpvt

    ...