Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

money fields with 4 decimal places

5 views
Skip to first unread message

Ramses Palomo

unread,
May 20, 1999, 3:00:00 AM5/20/99
to

how do i tell sybase in a select statement to return me the 4 digits of a
money field?


Bret Halford

unread,
May 20, 1999, 3:00:00 AM5/20/99
to Ramses Palomo
Ramses Palomo wrote:
>
> how do i tell sybase in a select statement to return me the 4 digits of a
> money field?

You can convert the money datatype to a numeric with 4 digits of
precision:

select convert(numeric(10,4),moneyfield) from table
go


--
Bret Halford
Sybase Technical Support
3665 Discovery Drive
Boulder, CO 80303

Joerg Gempe

unread,
May 21, 1999, 3:00:00 AM5/21/99
to Ramses Palomo
You can use:
select money*1. from table

joerg

gherm...@my-dejanews.com

unread,
May 22, 1999, 3:00:00 AM5/22/99
to
What if the system has multiple currency codes for
all of the money values being stored. Some could
have 0,1,2,or even 3 digits to the right of
the decimal point.

Converting to numeric(10,4) will yield inaccurate
results because all the values will now have zeros
padded such that they all have 4 digits to the
right of the decimal.

This can be overcome by deteriming the currency
code and applying a conversion to decimal 10,1 or
10,2 or 10,3 or 10,4 depending on the currency
code ( case statement ) but is very unwieldy and
eats up lots of resources.

Isn't there a way to just get the sql server to
display the exact value stored in a money type?

This would be much nicer and faster.

This is currently a huge discussion item on a
system I am working with and the Oracle biggots
are jumpming all over this saying that there
database does display the exact money type stored.

Any ideas ??


gh

In article <374452...@sybase.com>,


Bret Halford <br...@sybase.com> wrote:
> Ramses Palomo wrote:
> >
> > how do i tell sybase in a select statement to
return me the 4 digits of a
> > money field?
>

> You can convert the money datatype to a numeric
with 4 digits of
> precision:
>
> select convert(numeric(10,4),moneyfield) from
table
> go
>
> --
> Bret Halford
> Sybase Technical Support
> 3665 Discovery Drive
> Boulder, CO 80303
>

--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

0 new messages