Home All Groups Group Topic Archive Search About
Author
25 Aug 2006 9:09 AM
SoccerManic
Hi,

Can someone pls help me on the following problem.

How can I take only 8 decimal places on a numeric number?
e.g
turn 123456.12345678912 into 123456.12345679
turn 1234.123456789123 into 1234.12345679?

Thanks in advance.

Author
25 Aug 2006 9:17 AM
Chris Lim
SoccerManic wrote:
> How can I take only 8 decimal places on a numeric number?
> e.g
> turn 123456.12345678912 into 123456.12345679
> turn 1234.123456789123 into 1234.12345679?

I take it you tried the obvious (the ROUND() function) and it didn't do
what you want?
Author
25 Aug 2006 9:37 AM
SoccerManic
Yes. I tried the round function but it didn't quite work.

I need only 8 decimal places, pls advice. thanks

Show quote
"Chris Lim" <blackca***@hotmail.com> wrote in message
news:1156497439.129258.30860@h48g2000cwc.googlegroups.com...
> SoccerManic wrote:
>> How can I take only 8 decimal places on a numeric number?
>> e.g
>> turn 123456.12345678912 into 123456.12345679
>> turn 1234.123456789123 into 1234.12345679?
>
> I take it you tried the obvious (the ROUND() function) and it didn't do
> what you want?
>
Author
25 Aug 2006 10:33 AM
Chris Lim
SoccerManic wrote:
> Yes. I tried the round function but it didn't quite work.
>
> I need only 8 decimal places, pls advice. thanks

ROUND(<value>, 8) works for me.

Or do you mean you want to store to 8 decimal places as well? In which
case you need to CAST(<value> AS DECIMAL(16, 8)).
Author
26 Aug 2006 3:04 PM
gary7
SoccerManic wrote:
> Hi,
>
> Can someone pls help me on the following problem.
>
> How can I take only 8 decimal places on a numeric number?
> e.g
> turn 123456.12345678912 into 123456.12345679
> turn 1234.123456789123 into 1234.12345679?
>
> Thanks in advance.


Set the precision and scale values for the table columns in the data
base, if you have acces to modify the columns: decimal(18,8)

HTH

AddThis Social Bookmark Button