• Hello All,

    I'm not agree with explaination given.

    "Floating point data is approximate (http://msdn.microsoft.com/en-us/library/ms173773.aspx). So an increment of 0.1 will never be equal to 1 and the exit condition @i <> 1 always is true (infinite loop).

    The script contains two bad mistakes: floating comparison and a WHILE condition that easily falls into infinite loop. "

    Following script is also increasing the variable @i, but it iterate loop once.

    DECLARE @i float,@rc int

    set @i = 0

    while @i <> 1

    begin

    declare @a table(a int)

    set @i = @i + 0.9

    insert into @a

    select 1

    set @i = @i + 0.1

    end

    -- LAST SELECT

    SELECT * FROM @a