Re: MS SQL [ when to use the money datatype ]

2004-04-06 Thread Jochem van Dieten
Dan Farmer wrote:
 This may seem obvious but I have some fields that do represent money or 
 dollars.
 
 Should I use ( int, varchar or money ) what advantages does 'money' have 
 over 'int' ?

You should use numeric or decimal. Both are exact numeric types 
which allows you to specify the precision. The main reason not to 
use money is that it is not completely standardized, i.e. there 
is no money type in the JDBC spec. Also, depending on your 
requirements, using numeric and a separate column to store the 
currency is more flexible when working with multiple currencies.

Jochem

-- 
I don't get it
immigrants don't work
and steal our jobs
- Loesje
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: MS SQL [ when to use the money datatype ]

2004-04-06 Thread Nick de Voil
 You should use numeric or decimal. Both are exact numeric types
 which allows you to specify the precision. The main reason not to
 use money is that it is not completely standardized, i.e. there
 is no money type in the JDBC spec. Also, depending on your
 requirements, using numeric and a separate column to store the
 currency is more flexible when working with multiple currencies.

Dan didn't say it was an issue for him, but it may also be worth pointing
out that not all currencies have two decimal places. In one multicurrency
(banking) system in the past I stored all money amounts as integers (number
of pennies) and scaled as appropriate. Painful though.

Nick
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: MS SQL [ when to use the money datatype ]

2004-04-06 Thread Jochem van Dieten
Nick de Voil wrote:
 You should use numeric or decimal. Both are exact numeric types
 which allows you to specify the precision. The main reason not to
 use money is that it is not completely standardized, i.e. there
 is no money type in the JDBC spec. Also, depending on your
 requirements, using numeric and a separate column to store the
 currency is more flexible when working with multiple currencies.
 
 Dan didn't say it was an issue for him, but it may also be worth pointing
 out that not all currencies have two decimal places. In one multicurrency
 (banking) system in the past I stored all money amounts as integers (number
 of pennies) and scaled as appropriate. Painful though.

To be able to express the US deficit in Indonesian currency, and 
the value of an Indonesian rupiah in dollars, you will end up 
with something like NUMERIC(24,6). But then you can be reasonable 
certain that it will store everything you will ever need, and 
start worrying about the right places to round during 
calculations (which by itself was a 5 page document during the 
euro conversion).

Jochem

-- 
I don't get it
immigrants don't work
and steal our jobs
- Loesje
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




MS SQL [ when to use the money datatype ]

2004-04-05 Thread Dan Farmer
This may seem obvious but I have some fields that do represent money or 
dollars.

Should I use ( int, varchar or money ) what advantages does 'money' have 
over 'int' ?

__
Daniel Farmer
Producer / Coldfusion Developer
http://www.bernardclark.com/danfarmer.ca
P: 613.284.1684
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: MS SQL [ when to use the money datatype ]

2004-04-05 Thread Dick Applebaum
Money has a several advantages.

It handles dollars and cents

sorting money will give different (correct) results and text will not.

It possibly could be localized by an intelligent db.

It represents what the data type truly is.

Or, you could just store it as a blob :)

HTH

Dick

On Apr 5, 2004, at 6:06 PM, Dan Farmer wrote:

 This may seem obvious but I have some fields that do represent money or
dollars.

Should I use ( int, varchar or money ) what advantages does 'money' 
 have
over 'int' ?

__
Daniel Farmer
Producer / Coldfusion Developer
http://www.bernardclark.com/danfarmer.ca
P: 613.284.1684

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]