⟩ What Are Exact Numeric Data Types in MS SQL Server?
Exact numeric data types are used to store numeric values with exact precisions and scales. SQL Server 2005 supports the following exact numeric data types:
* BIGINT - 8-byte integers in the range of -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807).
* INT - 4-byte integers in the range of -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647).
* SMALLINT - 2-byte integers in the range of -2^15 (-32,768) to 2^15-1 (32,767).
* TINYINT - 1-byte integers in the range of 0 to 255.
* BIT - 1-bit integers with 2 values: 0 and 1.
* DECIMAL - Decimal numbers with a fixed precision p and a fixed scale s defined as DECIMAL(p,s). DECIMAL values are in the range of -10^38+1 to 10^38-1. DECIMAL has a synonym of DEC.
* NUMERIC - Same as DECIMAL.
* MONEY - Currency values stored in 8 bytes in the range of -922,337,203,685,477.5808 to 922,337,203,685,477.5807
* SMALLMONEY - Currency values stored in 4 bytes in the range of - 214,748.3648 to 214,748.3647
Here are some good examples of exact numeric values:
PRINT 372036854775808; -- BIGINT
PRINT 147483648; -- INT
PRINT 2768; -- SMALLINT
PRINT 250; -- TINYINT
PRINT 1; -- BIT
PRINT 12748.3648; -- DECIMAL(9,2)
PRINT 337203685477.58; -- MONEY
PRINT 748.36; -- SMALLMONEY
GO