UMG Developer (3/29/2011)
Tom.Thomson (3/29/2011)
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.
Why would it do that, the WHILE clause:
while @i < 255
shouldn't run the SELECT statement to increment @i when @i is 255. So the last iteration is with @i=254 getting incremented to 255.
O mo chreach! I must have gone crazy to read < as <=. :blush:
Tom