Database Reference
In-Depth Information
(a) Common Data Types in Microsoft SQL Server 2012
Figure 7-4
SQL Data types
in DBMS
Products
Numeric Data Types
Description
Bit
1-bit integer. Values of only 0, 1 or NULL .
Tinyint
1-byte integer. Range is from 0 to 255 .
Smallint
2-byte integer. Range is from −2 (15) ( −32,768 ) to +2 (15 1) ( +32,767 ).
4-byte integer. Range is from −2 (31) ( −2,147,483,468 ) to +2 (31 1)
( +2,147,483,467 ).
8-byte integer. Range is from −2 (63) ( −9,223,372,036,854,775,808 ) to +2 (63 1)
( +9,223,372,036,854,775,807 ).
Int
Bigint
Fixed precision (p) and scale (s) numbers. Range is from −10 38 +1 to 10 38 -1
with maximum precision (p) of 38. Precision ranges from 1 through
38, and default precision is 18. Scale (s) indicates the number of digits
to the right of the decimal place. Default scale value is 0, and scale
values range from 0 to p, where 0 <= s <= p.
Decimal (p[,s])
Numeric works identically to Decimal.
Numeric (p[,s])
4-byte money. Range is from −214,748.3646 to +214,748.3647 with
accuracy of one ten-thousandth of a monetary unit. Use decimal
point to separate digits.
Smallmoney
9-byte money. Range is from −922,337,203,685,477.5808 to
+922,337,203,685,477.5807 with accuracy of one ten-thousandth of
a monetary unit. Use decimal point to separate digits.
Money
n-bit storage of the mantissa in scientific floating point notation. The
value of n ranges from 1 to 53, and the default is 53.
Float (n)
Real
Equivalent to Float (24).
Date and Time
Data Types
Description
3-bytes fixed. Default format YYYY-MM-DD. Range is from January 1, 1
(0001-01-01) through December 31, 9999 (9999-12-31).
Date
5-bytes fixed is default with 100 nanosecond precision (.0000000).
Default format is HH:MM:SS.NNNNNNN. Range is from 00:00:00.0000000
through 23:59:59.9999999 .
Time
4-bytes fixed. Restricted date range, and rounds time to nearest
second. Range is from January 1, 1900 00:00:00 AM (1900-01-01
00:00:00) through June 6, 2079 23:59.59 PM (2079-06-06 23:59.59).
Smalldatetime
8-bytes fixed. Basically combines Date and Time, but spans less dates
and has less time precision (rounds to .000, .003 or .007 seconds).
Use DATETIME2 for more precision. Date range is from January 1,
1753 (1753-01-01) through December 31, 9999 (9999-12-31).
Datetime
8-bytes fixed. Combines Date and Time with full precision. Use
instead of DATETIME. Range is from January 1, 1 00:00:00.0000000 AM
(0001-01-01 00:00:00.0000000) through December 31, 9999
23:59.59.9999999 PM (9999-12-31 23:59.59.9999999).
Datetime2
Search WWH ::




Custom Search