The document provides a comprehensive overview of various data types used in databases, detailing their characteristics and allowed value ranges. It includes types such as BIGINT, BINARY, CHAR, DATE, and others, specifying their storage capabilities and precision. Additionally, it outlines the parameters for fixed and floating precision numbers, as well as unique identifiers and XML data storage.
Download as XLSX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
SQL Data Types
The document provides a comprehensive overview of various data types used in databases, detailing their characteristics and allowed value ranges. It includes types such as BIGINT, BINARY, CHAR, DATE, and others, specifying their storage capabilities and precision. Additionally, it outlines the parameters for fixed and floating precision numbers, as well as unique identifiers and XML data storage.
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Uses
Sl.No Data Type
Allows whole numbers between - 9,223,372,036,854,775,808 and 1 BIGINT 9,223,372,036,854,775,807
2 BINARY Fixed width binary string
3 BIT Integer that can be 0, 1, or NULL 4 CHAR Fixed width character string Store a date only. From January 1, 0001 to December 31, 5 DATE 9999 From January 1, 1753 to December 31, 9999 with an 6 datetime accuracy of 3.33 milliseconds From January 1, 0001 to December 31, 9999 with an 7 datetime2 accuracy of 100 nanoseconds The same as datetime2 with the addition of a time zone 8 datetimeoffset offset
Fixed precision and scale numbers.
Allows numbers from -10^38 +1 to 10^38 –1.
The p parameter indicates the maximum total number of
digits that can be stored (both to the left and to the right of the decimal point). p must be a value from 1 to 38. Default is 18.
The s parameter indicates the maximum number of digits
stored to the right of the decimal point. s must be a value 9 decimal(p,s) from 0 to p. Default value is 0
Floating precision number data from -1.79E + 308 to
1.79E + 308. The n parameter indicates whether the field should hold 4 or 8 bytes. float(24) holds a 4-byte field and float(53) 10 float(n) holds an 8-byte field. Default value of n is 53. 11 image Variable width binary string Allows whole numbers between -2,147,483,648 and 12 int 2,147,483,647 Monetary data from -922,337,203,685,477.5808 to 13 money 922,337,203,685,477.5807 14 ntext Variable width Unicode string
Fixed precision and scale numbers.
Allows numbers from -10^38 +1 to 10^38 –1.
The p parameter indicates the maximum total number of
digits that can be stored (both to the left and to the right of the decimal point). p must be a value from 1 to 38. Default is 18.
The s parameter indicates the maximum number of digits
stored to the right of the decimal point. s must be a value 15 numeric(p,s) from 0 to p. Default value is 0 Floating precision number data from -3.40E + 38 to 3.40E 16 real + 38 17 nchar Fixed width Unicode string 18 nvarchar Variable width Unicode string 19 nvarchar(max) Variable width Unicode string From January 1, 1900 to June 6, 2079 with an accuracy of 20 smalldatetime 1 minute 21 smallint Allows whole numbers between -32,768 and 32,767 22 smallmoney Monetary data from -214,748.3648 to 214,748.3647 Stores up to 8,000 bytes of data of various data types, 23 sql_variant except text, ntext, and timestamp 24 text Variable width character string 25 time Store a time only to an accuracy of 100 nanoseconds
Stores a unique number that gets updated every time a
row gets created or modified. The timestamp value is based upon an internal clock and does not correspond to real time. Each table may have only one timestamp 26 timestamp variable 27 tinyint Allows whole numbers from 0 to 255 28 uniqueidentifier Stores a globally unique identifier (GUID) 29 varbinary Variable width binary string 30 varbinary(max) Variable width binary string 31 varchar(n) Variable width character string 32 varchar(max) Variable width character string 33 xml Stores XML formatted data. Maximum 2GB