Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
donar
Starting Member
22 Posts |
Posted - 2005-04-15 : 10:13:18
|
| Hi, I have a question about decimal and float data type.I have one field which is now decimal(6,4), then the 0 will display as .0000, and 5 will display as 5.0000if I change it to float, then 0 will be 0.0, 5 will be 5.0The problem is when it is an integer, I just want it displayed as an integer , like 0 will be 0, 5 be 5, others have information after decimal point display as they are.How can I do this? Is there a system data type can do this?Thanks a lot! |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2005-04-15 : 10:58:04
|
| How a value is displayed is a function of the application (Query Analyzer?) not the database.If you wanted to convert the value to an integer, you could make use of either the CONVERT or CAST functions. See BOL for details. You may also want to read up on the ROUND function.HTH=================================================================Every act of conscious learning requires the willingness to suffer an injury to one's self-esteem. That is why young children, before they are aware of their own self-importance, learn so easily; and why older persons, especially if vain or important, cannot learn at all. -Thomas Szasz, author, professor of psychiatry (1920- ) |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-04-15 : 11:14:49
|
Don't use float or real....I wonder why the even existsBOLquote: float and realApproximate 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.Syntaxfloat [ ( 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).realFloating point number data from –3.40E + 38 through 3.40E + 38. Storage size is 4 bytes. In SQL Server, the synonym for real is float(24).
Brett8-) |
 |
|
|
|
|
|
|
|