Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Whats is the best way to store CURRENCY data type

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-03-17 : 08:32:27
hello,
what would be the best way to store currency values in my database, i was talking with a colleague who said. I shoudl create my own datatype, which later led to an argument, 'cause someone else said and i quote in red below

You might regret that.

It is not standard. The ODBC / OLE DB APIs don't deal with it properly. You have to cast between "money" and "currency" in your application.


and another said, use decimal/numeric

products
id int(11) autoincrement
description varchar(50)
price decimal(5,2)


please advice

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-17 : 08:35:13
Just use money or smallmoney, why reinvent the wheel? (Cue chadmat)

I worked with an application that used decimal(14,4) to store monetary values in the database. It used 9 bytes instead of the 8 bytes that money would've used, and could not hold the range of values money could.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-03-17 : 08:44:47
Am just seeing opinion, from the experts. Which doesnt hurt ? :-)

Why is there so much controversy about money data type then ?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-17 : 09:19:40
there is?? didn't know that.

it's probably because ppl don't know about the money type. or don't want to know.

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -