| Author |
Topic  |
|
|
arkiboys
Flowing Fount of Yak Knowledge
1341 Posts |
Posted - 07/02/2012 : 08:11:16
|
Hi, The select query retrieves a field which is of type float The value returned is: 138634.4698
declare @value1 float declare @value2 float
select @value1 = value1, @value2 = value2 from tblMain where ID = 1
In the table the value1 and value2 are 138634.4698 and 1865657.02 respectively.
Questions:
1- Do you know why my print statement below shows the value1 as 138634 ? print 'value1 -->' + convert(varchar(50), @value1)
2-Do you know why my print statement below shows the value2 as 138634 ? print 'value2 -->' + convert(varchar(50), @value2)
Thanks |
|
|
yosiasz
Flowing Fount of Yak Knowledge
USA
1608 Posts |
Posted - 07/02/2012 : 12:27:12
|
things are floating around
declare @value1 float declare @value2 float declare @value3 nvarchar(50) declare @value4 nvarchar(50)
select @value1 = 38634.4698 select @value3 = convert(decimal(10,4),@value1) select @value2 = 1865657.02 select @value4 = convert(decimal(10,2),@value2)
print 'value1 -->' + @value3
print 'value2 -->' + @value4
<><><><><><><><><><><><><><><><><> If you don't have the passion to help people, you have no passion |
 |
|
|
arkiboys
Flowing Fount of Yak Knowledge
1341 Posts |
Posted - 07/04/2012 : 07:16:34
|
| Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 07/04/2012 : 18:57:40
|
float is an approximate decimal value so if you want decimal level accuracy go for decimal or numeric
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
yosiasz
Flowing Fount of Yak Knowledge
USA
1608 Posts |
Posted - 07/05/2012 : 12:08:07
|
sure thing
<><><><><><><><><><><><><><><><><> If you don't have the passion to help people, you have no passion |
 |
|
| |
Topic  |
|