Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop a number from rounding off

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I am using a numeric field with the formula function..based on what the user puts into one field it will fill in the other field based on the formula. But how can I stop a number from rounding off.. eg. user types 1.3 the system will change that to 1

how can I stop this? should I not be using a numeric field??

Thanks dvannoy@onyxes.com
 
I changed the type to int. still when i type 1.3 it will round down to 1

anyone??? dvannoy@onyxes.com
 
Because it is an integer. That's why I told you to change to something else other than integer. Try decimal.

Andel
andel@barroga.net
 
SQL seems to hate doing math. However - the INT solution is the wrong direction. If you want it to keep the ".3" part of "1.3", you need to use a non-INT numeric field.
The NUMERIC datatype holds precision and scale. The books online will describe this better than I, so check there (look for the "Decimal and Numeric (T-SQL)" listing).
In short - the precision is for the digits on the left of the decimal point, the scale is for the digits on the right. If you define your field (or variable) as a NUMERIC(10,3), your "1.3" value would be look like "1.300".
If you're populating the field with a variable, make sure the variable is the same datatype.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top