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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

real number format question

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
I have a field declared as DataType = Real, Length = 4, Precision = 24, Scale = 0.
I look at the data through SQL Server Query Analyzer and the data looks like 52.214119.
But when I pull the data through a query in Microsoft Access or though a webpage using ASP, the data looks like 52.21412
Does anyone know why the number is stored as eight digits, but only returns 7 ??
Thanks
 
Check your front-end query. Something there is probably converting it to 7 digits.

When you use Access, what datatype is that field being displayed as?

-SQLBill
 
If you want to retrieve all the 8 digits then use the FORMATNUMBER function

Formatnumber(yournumber,8)

-VJ
 
Hi SQLBill,
My Frontend is just HTML, I pull the data back using a recordset in ASP and I read the value into a string, so I don't think it should truncate the value when reading into a string.
In MS Access, the field Datatype = Number, Field Size = Single, Decimal Places = Auto.
Thanks for the help
 
Hi VJ,
I tried the formatnumber and it rounds up the values and is not pulling back all the digits. But after thinking about it, I need 5 digits after the decimal point.
I put in a number like 101.1234567
SQL Server shows a number like 101.12346
The web page pulls back a number like 101.1235
So I might have to change the datatype to something so that I can always have at least 5 digits after the decimal and not worry about how many digits are in front of the decimal.
So I am going to try and increase the length of the real number to see if that works.
Thanks
KS
 
I changed the field to a float and it is allowing me to constantly have 5 digits after the decimal.
Thanks again for the help.
-KS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top