In QotD, posted on Aug 6 on ROWCOUNT and table variable

  • Hi,

    Pls help me on this. In QotD, question posted on Aug 6 on ROWCOUNT, the answer in infinite loop. ie, the condition @i <> 1 always is true . But another sample query as shown below gives expected result which contradicts from while loop.

    DECLARE @i float

    set @i = .9

    set @i = @i + .1

    -- Query 1

    if @i <> 1

    print 'Yes'

    else

    print 'No'

    Answer: No

    -- Query 2

    if @i = 1

    print 'Yes'

    else

    print 'No'

    Answer: Yes

    Can anyone pls explain on difference in this two.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply