List Of Data Types And Their Sizes

Facebooktwitterredditpinterestlinkedinmail

The below table shows the storage sizes of the different data types in SQL Server.

[table caption=”DateTime Data Types” th=”0″ width=”500″ colwidth=”150|150″]
date,3 bytes
datetime,8 bytes
datetime2,6 – 8 bytes (depending on precision)
datetimeoffset,10 bytes
smalldatetime,4 bytes
time,5 bytes
[/table]

[table caption=”Numeric Data Types” th=”0″ width=”500″ colwidth=”150|150″]
decimal,5 – 17 bytes
numeric,5 – 17 bytes
float,4 or 8 bytes
real,4 bytes
bigint,8 bytes
int,4 bytes
smallint,2 bytes
tinyint,1 byte
money,8 bytes
smallmoney,4 bytes
[/table]

[table caption=”String” th=”0″ width=”500″ colwidth=”150|150″]
char,size defined in table
varchar,2 bytes + data size
text,data size
nchar,2 times size defined in table
nvarchar,2 bytes + 2 times data size
ntext,2 times data size
[/table]

[table caption=”Binary” th=”0″ width=”500″ colwidth=”150|150″]
binary,size defined in table
varbinary,2 bytes + data size
image,2 bytes + data size
[/table]

[table caption=”Other” th=”0″ width=”500″ colwidth=”150|150″]
bit,1 byte
hierarchyid,5 bytes
uniqueidentifier,16 bytes
[/table]

Reference: http://msdn.microsoft.com/en-us/library/ff848794.aspx

1 thought on “List Of Data Types And Their Sizes”

Leave a Comment

CommentLuv badge