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
 SQL Server Development (2000)
 decimal or numeric

Author  Topic 

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2003-07-17 : 09:30:10
or for that matter float

all i need to store is a 2 decimal place number are there any great advantages or disadvantages to using any of these datatypes ? SQL Server 7.

Sure i've seen this before but have grown a beard waiting for the search to finish so thought i would just post it again.

thanks


====
Paul

chadmat
The Chadinator

1974 Posts

Posted - 2003-07-17 : 12:02:26
I wouldn't use float. I think the other 2 are equivalent to each other.

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-07-17 : 12:15:16
i like money, actually .... sometimes with certain sized decimal() or numeric() datatypes, ADO and ODBC and other interfaces can't correctly interpret the data types, and it links to them as text.

money is pretty consistent, good for <=4 decimal places of accuracy, and ADO/ODBC/etc has no trouble with it.

- Jeff
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-07-17 : 18:44:46
quote:
i like money, actually .... sometimes with certain sized decimal() or numeric() datatypes, ADO and ODBC and other interfaces can't correctly interpret the data types, and it links to them as text.

money is pretty consistent, good for <=4 decimal places of accuracy, and ADO/ODBC/etc has no trouble with it.
While on the other hand, Oracle ODBC and OLE DB drivers love to convert every numeric type to decimal(38,0), even regular ints.

Float and real should be your last choice because they are approximate values, and you can get lots of little rounding errors with them. Sooner or later you'll get a SELECT 4/2.0 that comes out as 1.99999999999998 or 2.0000000000001, or something like that. Makes tightly formatted HTML/web pages suddenly look like crap.

Go to Top of Page
   

- Advertisement -