SQL Server Data Types

The major data types available in Microsoft SQL Server

String and Binary Types

Data Type Syntax

Maximum Size

Notes

CHAR(size)

8,000 characters

size is the number of characters to store. Fixed-length. Spaces added to the end of the string up to size. Single byte per character.

VARCHAR(size) or VARCHAR(max)

8,000 characters or 2GB.

size is the maximum number of characters that can be stored. Variable-length. For varchar(max), the maximum number of characters is 2GB. Single byte per character.

NCHAR(size)

4,000 characters

size is the number of characters to store. Unicode 2 bytes per character.

NVARCHAR(size) or NVARCHAR(max)

4,000 characters or 2GB

size is the maximum number of characters that can be stored. Variable-length. For varchar(max), the maximum number of bytes is 2GB. Unicode 2 bytes per character.

BINARY(size)

8,000 characters

size is the number of bytes to store. Fixed-length. Padded to equal size characters.

VARBINARY(size) or VARBINARY(max)

8,000 or 2GB

size is the number of bytes to store. Variable-length. If max is specified, the maximum number of characters is 2GB.

TEXT

2,147,483,647 characters

Deprecated. Do not use

NTEXT

1,073,741,823 characters

Deprecated. Do not use

IMAGE

2,147,483,647 characters

Deprecated. Do not use

Numeric Types

Data Type Syntax

Maximum Size

Notes

BIT

0, 1, or NULL.

non-nullable uses a single bit; nullable requires 2 bits

TINYINT

0 to 255

single byte (8-bit) integer

SMALLINT

-32768 to 32767

16-bit integer 

INT

-2,147,483,648 to 2,147,483,647

 32-bit integer

BIGINT

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

 64-bit integer

DECIMAL(m,d)

m defaults to 18, if not specified.
d defaults to 0, if not specified.

m is the total digits and d is the number of digits after the decimal
Equivalent to NUMERIC

NUMERIC(m,d)

m defaults to 18, if not specified.
d defaults to 0, if not specified.

m is the total digits and d is the number of digits after the decimal
Equivalent to DECIMAL

FLOAT(m)

Floating point number.
m defaults to 53, if not specified.

m is the number of bits used to store the mantissa: m x 10n

REAL

Equivalent to FLOAT(24)

 

SMALLMONEY

- 214,748.3648 to 214,748.3647

 

MONEY

-922,337,203,685,477.5808 to 922,337,203,685,477.5807

 

Date/Time Types

Data Type Syntax

Maximum Size

Notes

DATE

Values range from '0001-01-01' to '9999-12-31'.

 

DATETIME2(fractional seconds precision)

Date values range from '0001-01-01' to '9999-12-31'.
Time values range from '00:00:00' to '23:59:59:9999999'.

 

DATETIMEOFFSET (fractional seconds precision)

Date values range from '0001-01-01' to '9999-12-31'.
Time values range from '00:00:00' to '23:59:59:9999999'.
Time zone offset range from -14:00 to +14:00.

TIME

Values range from '00:00:00.0000000' to '23:59:59.9999999'

 

DATETIME

Date values range from '1753-01-01 00:00:00' to '9999-12-31 23:59:59'.
Time values range from '00:00:00' to '23:59:59:997'

Deprecated. Do not use

SMALLDATETIME

Date values range from '1900-01-01' to '2079-06-06'.
Time values range from '00:00:00' to '23:59:59'.

Deprecated. Do not use