SQL Server Data Types
Numeric Types
Type | Storage Size | Description |
---|---|---|
int | 4 bytes | Integer data ranging from -2,147,483,648 to 2,147,483,647. |
bigint | 8 bytes | Large integer data ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. |
smallint | 2 bytes | Integer data ranging from -32,768 to 32,767. |
tinyint | 1 byte | Unsigned integer ranging from 0 to 255. |
decimal(p,s) | Variable (2-17 bytes) | Fixed precision and scale numeric data. |
numeric(p,s) | Variable (2-17 bytes) | Synonym for decimal. |
float | 4 or 8 bytes | Floating‑point number. Precision determined by n. |
real | 4 bytes | Floating‑point number with 7 digits precision. |
money | 8 bytes | Currency values with four decimal places. |
smallmoney | 4 bytes | Currency values with four decimal places. |
Character & String Types
Type | Storage Size | Description |
---|---|---|
char(n) | n bytes | Fixed‑length non‑Unicode string. |
varchar(n) | Variable (0‑8000 bytes) | Variable‑length non‑Unicode string. |
text | Variable (up to 2 GB) | Deprecated large non‑Unicode data. |
nchar(n) | 2n bytes | Fixed‑length Unicode string. |
nvarchar(n) | Variable (0‑4000 bytes) | Variable‑length Unicode string. |
ntext | Variable (up to 2 GB) | Deprecated large Unicode data. |
binary(n) | n bytes | Fixed‑length binary data. |
varbinary(n) | Variable (0‑8000 bytes) | Variable‑length binary data. |
image | Variable (up to 2 GB) | Deprecated large binary data. |
Date & Time Types
Type | Storage Size | Description |
---|---|---|
date | 3 bytes | Store date only (YYYY‑MM‑DD). |
datetime | 8 bytes | Date and time (range 1753‑01‑01 to 9999‑12‑31). |
datetime2(p) | 6‑8 bytes | Extended range and precision. |
datetimeoffset(p) | 8‑10 bytes | Date, time, and offset from UTC. |
smalldatetime | 4 bytes | Less precise date & time. |
time(p) | 3‑5 bytes | Time of day only. |
timestamp | 8 bytes | Row versioning; synonym for rowversion. |
rowversion | 8 bytes | Automatic binary numbers for version‑stamping rows. |
Miscellaneous Types
Type | Storage Size | Description |
---|---|---|
uniqueidentifier | 16 bytes | Globally unique identifier (GUID). |
xml | Variable (up to 2 GB) | XML data storage with typed support. |
sql_variant | Variable (up to 8019 bytes) | Stores values of various SQL Server data types. |
hierarchyid | Variable (up to 892 bytes) | Represents hierarchical data. |
geography | Variable (up to 2 GB) | Spatial data based on a round‑earth model. |
geometry | Variable (up to 2 GB) | Spatial data based on a flat‑plane model. |