• vk-kirov (1/20/2010)


    mzz3lh (1/20/2010)


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

    Probably the IMPLICIT_TRANSACTIONS option is turned on.

    Try this code:

    SET IMPLICIT_TRANSACTIONS OFF

    GO

    ... here comes the original script ...

    Good call, cheers. I had it switched on without realising, so the create table statement was obviously not autocommitting.

    I still think the options in the question were wrong though, even after running the code successfully. The third option implied the 'this is an exception' string formed part of the table data, when clearly it was a printed message.