• mzz3lh (1/20/2010)


    I have to agree here. None of the answers match what I would expect, which would be 'This is an exception' in the message pane, followed by the contents of the temp table: 1, 2, 4, 5.

    However, when I ran this to try it out, I got an error:

    (1 row(s) affected)

    (1 row(s) affected)

    this is an exception

    Msg 208, Level 16, State 0, Line 10

    Invalid object name '#temp'.

    Which indicates that despite the try-catch block, the error caused the temp table to be dropped mid-execution.

    Or that something was wrong with the code you ran. It ran fine for me, and it appears from a few other posts that it ran fine for others.

    I agree, the answers may not have been displayed as many of us have seen it when we ran the code. The question is, were you able to correctly predict the output? In this case, as mentioned in another post, there really was only one option that could be correct. It may have been more difficult had there been one or two more possible answers with the exception message included.