• Kevin Gill (1/15/2010)


    To my mind, this question could/should have been moderated and edited to make it clearer.

    Even though I would have got it wrong had it actually been asking what I thought it was, the fact that it was pretty badly written added an additional, unnecessary level of misdirection that just gets in the way.

    The 'correct' answer does not in itself actually answer the question - I have no more idea now than I had ten minutes ago whether table VARIABLES in SQL2K5 can be set to NULL, even though I did actually know that you can't have table parameters in SQL 2K5 (as they would have solved a lot of my problems last year). I skimmed the answers, thought 'I know SQL2K5 can have table variables' (I admit - misreading on my part but I assumed that if it was a 'trick' question then that answer would refer to all parts of the question equally, given that there's only single word answers for the other options) and gave some thought to whether a table VARIABLE can be set to NULL or not. I made my choice, got it wrong, but didn't actually find out the answer.

    So can table variables be set to NULL? Perhaps this could be added to the explanation...

    I agree that the full answer "table variables cannot be set to null and are not supported as SP parameters in SQL2005" wasn't provided. Of the three options given, only one was actually incorrect, the other two were each correct but not the whole truth, so that the only option for answering was to select one of them at random. So I think that the question with its three optional ansers was rather poor. I got the point anyway because I guessed that the questioner probably would think the lack of an enhancement was more significant than not being able to set table variables to null (which would be pointless thing to be able to do, because there's no concept of a null table in SQL Server so what would a table variable having value null mean?). But I think everyone who picked the wrong correct answer should have gotten a point too.

    Tom