August 23, 2005 at 12:48 pm
Hi All,
I had a problem with real datatype. When i insert data with more than 7 digits then the data is not inserting properly.
EX:
declare @tabl table(Rate real)
insert into @tabl values(777777777)
insert into @tabl values(77777777)
select Rate,convert(decimal,Rate) as decimalRate from @tabl
The resulsts are:
ate decimalRate
------------------------ --------------------
7.7777779E+8 777777792
7.7777776E+7 77777776
FOr the first row decimalRate
Expected result:777777777
Actual result:777777792
why is this happening?.
Thanks,
Murthy
August 23, 2005 at 12:59 pm
Real takes 7 digits & Float takes 15 digits. I never had a chance to use this datatype. Can any one please give an example or use of this datatype.
BOL
Approximate number data types for use with floating point numeric data. Floating point data is approximate; not all values in the data type range can be precisely represented.
float [ ( n ) ]
Is a floating point number data from - 1.79E + 308 through 1.79E + 308. n is the number of bits used to store the mantissa of the float number in scientific notation and thus dictates the precision and storage size. n must be a value from 1 through 53.
n is | Precision | Storage size |
---|---|---|
1-24 | 7 digits | 4 bytes |
25-53 | 15 digits | 8 bytes |
The Microsoft® SQL Server™ float[(n)] data type conforms to the SQL-92 standard for all values of n from 1 to 53. The synonym for double precision is float(53).
real
Floating point number data from –3.
Regards,
gova
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply