Friday, March 6, 2009

Float vs. Decimal

I used float instead of decimal, I'll never do that again.
I found some stored procedures, that had numeric parameters used as varchar. I'll never do that either.
Check out why:

1st case:





declare @a as float
set @a = 13705.05
select @a

declare @b as varchar(100)
set @b = @a
select @b





2nd case:





declare @a as float
set @a = 137.86
select @a

declare @b as varchar(100)
set @b = @a
select @b





Run them, You'll get this:
1st case:

13705.05
13705

2nd case:

137.86
137.86

see my point?

No comments: