MSDN
SQL Server – Database Design – Data Types

SQL Server Data Types

Numeric Types

Numeric data types store numbers. Choose the smallest type that can accommodate your data.

TypeStorageRangeExample
tinyint1 byte0‑255200
smallint2 bytes-32,768‑32,767-1200
int4 bytes-2,147,483,648‑2,147,483,6471024
bigint8 bytes-9,223,372,036,854,775,808‑9,223,372,036,854,775,8071234567890123
decimal(p,s)VariesExact numericdecimal(10,2) = 12345.67
float4 or 8 bytesApproximate numeric3.14159

Character & String Types

Store text data. Use fixed‑length types when the length is consistent; otherwise use variable‑length.

TypeStorageMax LengthUsage
char(n)n bytes1‑8000Fixed length
varchar(n)2 + actual length1‑8000Variable length
varchar(max)2 + actual length2^31‑1 bytesLarge text
nchar(n)2n bytes1‑4000Unicode fixed
nvarchar(n)2 + actual length1‑4000Unicode variable
nvarchar(max)2 + actual length2^31‑1 bytesUnicode large text

Date & Time Types

Store temporal information with various precisions.

TypeStorageRangePrecision
date3 bytes0001‑01‑01 to 9999‑12‑31Day
datetime8 bytes1753‑01‑01 to 9999‑12‑313.33 ms
datetime2(p)6‑8 bytes0001‑01‑01 to 9999‑12‑31100 ns
datetimeoffset(p)10‑12 bytesSame as datetime2Time zone offset
time(p)3‑5 bytes00:00:00 to 23:59:59.9999999100 ns
smalldatetime4 bytes1900‑01‑01 to 2079‑06‑06Minute

Binary Types

Store raw binary data such as images or files.

TypeStorageMax Length
binary(n)n bytes1‑8000
varbinary(n)2 + actual length1‑8000
varbinary(max)2 + actual length2^31‑1 bytes
imageVariable2^31‑1 bytes (deprecate)

Other Types

  • uniqueidentifier – 16‑byte GUID.
  • sql_variant – Stores values of various data types.
  • xml – Stores XML data with optional schema validation.
  • geography and geometry – Spatial data types.