• Kiran,

    You were very close to getting your code to run. The line "END CASE" should just be "END". I wrote a test case demonstration, based on your information.

    -- Create university Table.

    CREATE TABLE dbo.university

    (

    [id] NUMERIC(10,0)

    ); NUMBER(10,0)

    );

    -- Insert sample data.

    INSERT INTO university VALUES (1);

    INSERT INTO university VALUES (2);

    INSERT INTO university VALUES (3);

    INSERT INTO university VALUES (4);

    INSERT INTO university VALUES (5);

    -- Select the data as a preview.

    select [id] from university

    -- Build the case statement with the following Rules:

    -- ID of 2 = GOOD

    -- ID of 3 = POOR

    -- ID of 4 = EXCELLENT

    -- all other ID values default to = BAD

    SELECT

    [id], -- Display the original value for [id].

    CASE u.[id]

    WHEN 2 THEN 'GOOD'

    WHEN 3 THEN 'POOR'

    WHEN 4 THEN 'EXCELLENT'

    ELSE 'BAD'

    END AS 'GRADE_REMARK' -- this is just a column label

    FROM dbo.university AS u

    -- Clean up the demonstration.

    -- Drop the university table.

    DROP TABLE dbo.university

    Let me know if this is what you were expecting.

    Best Regards,

    "Key"
    MCITP: DBA, MCSE, MCTS: SQL 2005, OCP