Money, decimal or numeric for currency columns

I am creating an SQL table to store transactions:

create table dbo.TRANSACTIONS
(
  Id int identity not null,
  Amount money not null
);

For currency (do I use euros) should I use money, decimal or numeric?

I saw how three were applied to currency columns, so I'm not sure anymore.

Money would be an obvious choice ... But I saw a decimal and numerical value.

By the way, I'm using SQL Server 2012.

thank

+3
source share
4 answers

First of all, Decimal and Numeric have the same functionality ( MSDN information about it )

VS decimal, Stackoverflow: MONEY DECIMAL (x, y) SQL Server? - :

, , , /

SQLMenace

+6

,

Sql , .

, DECIMAL.

Re: DECIMAL (19,4) vs (20,4)

.

19,4 999 999 999 999 999.9999, 9 . 20 13, , ( 28 ).

, 9 , . 19,2, 99 999 999 999 999 999.99

+1

, . , 100.

0

It looks like you are working in a single currency (Euro), so I would use decimal, not monetary. The main advantage of money is that it can be displayed in a "convenient for localization" way.

Money has limited accuracy, so it is more prone to rounding errors. Additives and deductions are fine, but if you split the money into money (for interest or ratios), you will lose accuracy, especially with repeated operations.

0
source

All Articles