Updated on Kisan Patel
In this tutorial, we have list out the sql server data type with its range.
To store any kind of integer data, we can use following data types. Notice the Range column that is the min and max limit of data we can store.
Data type | Range | Storage |
---|---|---|
bigint | (-9,223,372,036,854,775,808) to (9,223,372,036,854,775,807) | 8 Bytes |
int | (-2,147,483,648) to(2,147,483,647) | 4 Bytes |
smallint | (-32,768) to (32,767) | 2 Bytes |
tinyint | 0 to 255 | 1 Byte |
To store any decimal or numeric data, we can use following data types.
Data type | Precision | Storage bytes |
---|---|---|
DecimalNumeric | 1 – 9 | 5 |
10-19 | 9 | |
20-28 | 13 | |
29-38 | 17 |
Numeric maps to the Decimal data type of the .NET and it is functionally equivalent to the Decimal data type.
To store small number with floating decimal point, float data type can be used.
Data type | Range | Storage |
---|---|---|
float | – 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308 | |
real | – 3.40E + 38 to -1.18E – 38, 0 and 1.18E – 38 to 3.40E + 38 | 4 Bytes |
To store monetary data, money or smallmoney data type can be used.
Data type | Range | Storage |
---|---|---|
money | -922,337,203,685,477.5808 to 922,337,203,685,477.5807 | 8 bytes |
smallmoney | – 214,748.3648 to 214,748.3647 | 4 bytes |
Data type | Description |
---|---|
Char(n) | Used to store fixed length characters |
Varchar(n) | Used to store variable length characters |
Nchar(n) | Used to store fixed length Unicode UCS-2 characters set |
Nvarchar(n) | Used to store variable length Unicode UCS-2 characters set |
Time | Used to store time (hh:mm:ss] |
Date | Used to store date (YYYY-MM-DD) |
Datetime | Used to store date along with time with fractional seconds |
Smalldatetime | Used to store date along with time |
Datetime2 | Stores the date along with time with larger fractional precious seconds |
Bit | To store true (1) or false (0) |
Binary | To store binary data of fixed length |
Varbinary(n) | To store binary data of variable length |
Uniqueidentifier | A 36 character length unique GUID data can be stored |
Text | To store variable length large data |
Ntext | To store variable length large Unicode data |
Image | To store variable length binary data (to store image or file into database table) |