• 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.

    I ran this on sql server 2008 and did not get that behavior