MSDN

Microsoft Docs

DECIMAL (Transact‑SQL)

Overview

The DECIMAL data type stores fixed‑precision numbers. It is synonymous with NUMERIC and behaves identically.

Syntax

DECIMAL [ (precision [ , scale ] ) ]

Both precision and scale are optional. If omitted, the default is DECIMAL(18,0).

Range

The range depends on the specified precision and scale. For DECIMAL(p,s):

  • Maximum value: 10^p – 10^(–s)
  • Minimum value: –(10^p – 10^(–s))

Example: DECIMAL(5,2) stores values from –999.99 to 999.99.

Storage Size

PrecisionStorage (bytes)
1‑95
10‑199
20‑2813
29‑3817

Example

CREATE TABLE Sales
(
    SaleID      INT PRIMARY KEY,
    Amount      DECIMAL(10,2) NOT NULL,
    TaxRate     DECIMAL(5,4) NULL
);

INSERT INTO Sales (SaleID, Amount, TaxRate)
VALUES (1, 12345.67, 0.0750);

Remarks

  • Use DECIMAL when exact numeric precision is required, such as monetary values.
  • Arithmetic operations preserve scale; overflow raises an error unless SET ARITHABORT OFF is used.
  • When combined with FLOAT or REAL, the result is of type FLOAT.

See Also