Page 54 - SQL
P. 54
Chapter 13: Data Types
Examples
DECIMAL and NUMERIC
Fixed precision and scale decimal numbers. DECIMAL and NUMERIC are functionally equivalent.
Syntax:
DECIMAL ( precision [ , scale] )
NUMERIC ( precision [ , scale] )
Examples:
SELECT CAST(123 AS DECIMAL(5,2)) --returns 123.00
SELECT CAST(12345.12 AS NUMERIC(10,5)) --returns 12345.12000
FLOAT and REAL
Approximate-number data types for use with floating point numeric data.
SELECT CAST( PI() AS FLOAT) --returns 3.14159265358979
SELECT CAST( PI() AS REAL) --returns 3.141593
Integers
Exact-number data types that use integer data.
Data
Range Storage
type
-2^63 (-9,223,372,036,854,775,808) to 2^63-1
bigint 8 Bytes
(9,223,372,036,854,775,807)
int -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647) 4 Bytes
smallint -2^15 (-32,768) to 2^15-1 (32,767) 2 Bytes
tinyint 0 to 255 1 Byte
MONEY and SMALLMONEY
Data types that represent monetary or currency values.
https://riptutorial.com/ 36

