Skip navigation

Lu's Notes

down to bottom of page

SQL Data Types

Name Type of Data Description #bytes SQL Example
int integer Numbers 4 intCount int,
bigint integer Numbers 8  
smallint integer Numbers 2  
tinyint integer Numbers 1  
tinyint integer Numbers 1  
decimal[(p[,s])] exact numeric Numbers, precise decimal values
[presion, scale]
2-17  
numeric[(p[,s])] exact numeric Numbers, precise decimal values
[presion, scale]
2-17  
float(n) approx numeric Numbers, floating point value 8  
real(n) approx numeric Numbers, floating point value 4  
money monetary Numbers 8  
smallmoney monetary Numbers 4  
Datetime Date&Time   8  
smalldatetime Date&Time   4  
char(n) Character Fixed width character data or strings
can not exceed 8000, size of page is 8000
0-8000  
varchar(n) Character Variable width character data or strings 0-8000 txtName varchar(20),
text Character Variable width, Binary large objects (BLOB) for data or strings 0-2GB  
nchar(n) Unicode character Fixed width character data or strings 0-8000  
nvarchar(n) Unicode character Variable width character data or strings 0-8000  
ntext Unicode character Variable width, Binary large objects (BLOB) for data or strings 0-2GB  
binary(n) Binary "0" or "1" only 0-8000  
varbinary(n) Binary Binary variable width 0-8000  
uniqueidentifier Unique ID Globally unique identifier 16-byte hexadecimal value 16  
image Image Binary large objects (BLOB) 0-2GB  
bit Special value 0 or 1 1 lptHTML bit,
cursor Special for programming within stored procedures 0-8  
timestamp Special rowversion 8-byte binary unqiue within datbase 8  
sysname Special   256  
table Special only to define local table variables or return value of user-defined function    
sql_variant Special   0-8016  

up to top of page   Return to Top of Page   up to top of page up to top of page