• i wouldnt use PRINT to test it, it doesnt handle NULL's well.

    And dont run every option in the same pass, it will muck up your results. If you want to test try this:

    -- The declarations

    DECLARE @val int;

    SET @val = -1

    CREATE TABLE #empty (val int)

    -- The Tests

    set @val = NULL

    --SELECT @val = NULL FROM #empty

    --SELECT @val = val FROM #empty

    --SELECT @val = (SELECT val FROM #empty)

    -- You need this because the previous lines only set the values, they won't print them

    select @val

    -- Tidy up the temp table

    drop table #empty

    just uncomment the line you want to test with.

    You could just create the temp table once and then declare your variables etc, but I didnt think efficiency was necessary for this, so I just copied and pasted 🙂

    And NULL's can be cool, they just need some understanding, although that list keeps growing as you start exploring more and more functionality that SQL Server has to offer.

    Admittedly I tried to answer it prior to testing and got it wrong 😛

    You live and learn...

    O' and unless Steve fixed it after the last post, it was a select list, not a multiple choice 🙂

    -d