// data type reference
MONEY
Native MONEY types exist in only two of the five engines.
- Family
- Exact decimals
- Missing in
- MySQL, SQLite, Oracle
- Gotchas
- 4 listed
Engine by engine
SQL Server MONEY (8 bytes, scale 4) and PostgreSQL's locale-aware MONEY; the other three engines use DECIMAL(19,4) or NUMBER(19,4).
| 엔진 | 타입 | 저장소 | 메모 |
|---|---|---|---|
| SQL Server |
MONEY / SMALLMONEY
|
8 / 4 bytes | Fixed scale 4; MONEY spans about +/-922 trillion, SMALLMONEY about +/-214,748.3647. |
| PostgreSQL |
MONEY
|
8 bytes | No precision modifier: the number of decimals and the currency symbol both come from the lc_monetary setting. |
| MySQL |
no MONEY - use DECIMAL(19,4)
Workaround
|
9 bytes | The idiomatic money column is DECIMAL with scale 4 (or 2). |
| SQLite |
no MONEY - use INTEGER cents
Workaround
|
variable | Common recipes: INTEGER minor units, or NUMERIC plus application rounding. |
| Oracle |
no MONEY - use NUMBER(19,4)
Workaround
|
1-12 bytes | NUMBER(19,4) is the standard stand-in. |
Gotchas
Where the engines disagree. These tend to surface as bugs during a migration or a port.
- SQL Server's MONEY keeps 4 decimals through every intermediate step: CAST(1 AS MONEY) / CAST(3 AS MONEY) * 3 returns 0.9999. DECIMAL(p,s) widens intermediate scale, so it is the safer default for financial math.
- PostgreSQL's MONEY is locale-aware: a dump taken with one lc_monetary and restored under another can misread the values. Most teams use NUMERIC instead.
- Three of the five engines have no MONEY at all, so a portable schema means DECIMAL(19,4) / NUMBER(19,4) from the start.
- MONEY columns accept more decimals than they keep: SQL Server silently rounds to 4 places on insert.
Common questions
Should I use MONEY or DECIMAL for money?
Prefer DECIMAL/NUMERIC. MONEY's fixed scale and, in PostgreSQL, locale-dependent output make it a reliable source of surprises.
What is SQL Server SMALLMONEY?
A 4-byte money type with scale 4 and a range of -214,748.3648 to 214,748.3647.
Related on SQLly
// map types before you move data
Map a type to the other four engines
The free type converter maps a type from one engine to its closest equivalent in the others and says where storage, precision or behaviour differ. The desktop app does the same mapping while you edit.