• Christian Buettner-167247 (3/28/2011)


    Tom.Thomson (3/27/2011)


    One comment though: depending on settings of ARITHABORT and ANSI WARNINGS, it is quite possible that none of the answer options will result, because the batch is terminated before it reaches the select statement.

    Why should the batch be terminated? I don't see any issues here.

    If ARITHABORT is ON and ANSI WARNINGS off, arithmetic overlow causes the batch to be aborted. See the second sentence of the remarks section of this BoL page.

    SELECT @i+=1 will cause arithmetic overflow on the last iteration, attempting to set a tinyint to 256.

    Tom