same query but different result- WHY?

  • hey all

    there seems to be two different results for the following queries.

    a) select round(101.2345,2)

     

    b) declare @var int

        set @var = 101.2345

        select round(@var,2)

    can u explain why there happens to be two different results

    thanx

    Rajiv.

  • You can't declare int type since it is Integer (whole number), Use declare @var decimal (7,4). 

  • hey allen

    i think even if i declare it as decimal .....i get different results....why?

    i did::::

    declare @var decimal

    thanx

    Rajiv.

  • you must specify the precision :

    declare @var decimal (7,4)

  • hey all

    thanx for ur help...now i got it

    thanx

    Rajiv.

Viewing 5 posts - 1 through 4 (of 4 total)

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