October 29, 2007 at 2:57 pm
what data type should i define a col as for data that is 0.891?
October 29, 2007 at 3:09 pm
You can use Float
October 29, 2007 at 3:10 pm
You cal also use 'real'.
float
- 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308
Depends on the value of n(Storage)
real
- 3.40E + 38 to -1.18E - 38, 0 and 1.18E - 38 to 3.40E + 38
4 Bytes (Storage)
October 29, 2007 at 3:13 pm
i thought float,real and numeric were non-deterministic so you get approximations like 3.99999999999999999994 for the value of 4.00 stored and such...., and it was better to use money or decimal datatypes, like decimal(6,4)?
am i wrong?
Lowell
October 29, 2007 at 3:19 pm
Decimal(x,y) is a better option.
******************
Dinakar Nethi
Life is short. Enjoy it.
******************
October 29, 2007 at 3:24 pm
Yup,Decimal(x,y) is better
October 30, 2007 at 6:16 am
Lowell (10/29/2007)
i thought float,real and numeric were non-deterministic so you get approximations like 3.99999999999999999994 for the value of 4.00 stored and such...., and it was better to use money or decimal datatypes, like decimal(6,4)?am i wrong?
You're right. Decimal is the way to go here:
DECIMAL(Total Digits, digits to the right of the decimal)
or in this case:
DECIMAL (5,4)
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 30, 2007 at 6:28 am
I think Decimal(x, y) would be a better option.
Cheers!
Sandy.
--
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply