Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Data types in Sql Server2005

Posted by Viral Sarvaiya on October 13, 2009

Data type name Number of bytes Comments
Integer tinyint 1
smallint 2
int 4
bigint 8
Exact numeric decimal[p[,s]] 5-17
numeric[p[,s]] 5-17
Appropiate numeric float[(n)[ 8
real 4
Monetary smallmoney 4
money 8
Date and time smalldatetime 4
datetime 8
Characters char[(n)] 0-8000 non-Unicode
varchar[(n)] 0-8000 non-Unicode
varchar(max) 0-2 GB non-Unicode, 16 bytes pointer on row, ,preferred over text data type
text 0-2 GB non-Unicode, 16 bytes pointer or in row, obsolete, varchar(max) prefered
nchar[(n)] 0-8000 max 4000 unicode characters
nvarchar[(n)] 0-8000 max 4000 unicode characters
nvarchar(max) 0-2 GB 16 bytes pointer or in row, ,preferred over ntext data type
ntext 0-2 GB 16 bytes pointer, obsolete, nvarchar(max) prefered
Binary binary[(n)] 0-8000
varbinary[(n)] 0-8000
varbinary(max) 0-2 GB 16 bytes pointer or in row, ,preferred over image data type
Image image 0-2 GB 16 bytes pointer, obsolete, varbinary(max) prefered
Global identifier uniqueidentifier 16
XML xml 0-2GB 16 bytes pointer
Special bit 1 1 byte for every 8 bit columns
cursor 0-8
timestamp 8 one column per table
sysname 256
table
sql_variant 0-8016
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: