• Philippe Lauwers (2/11/2009)


    I could hardly believe I got it wrong, so I tried it in DbVisualiser ... I got 1,4,5,7,8 (just as I thought I would). Could this have something to do with using DbVisualiser (I guess not, since SQL is executed on the server anyway)?

    My interpretation is as follows:

    This opens a block comment... /*

    ...so this is not printed PRINT '6'

    This is ignored since it is part of the block comment --/*

    and it is not the closing of the block comment

    This closes the block comment... */

    ...thanks to which this is printed PRINT '7'

    This is an inline comment so it does nothing --*/

    This is printed PRINT '8'

    Philippe, can you try this in Query Analyzer/SSMS (whichever version you have) and see if you get a different answer (which you will) - then I guess it is something to do with DbVisualiser !??!?

    Kev