Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

Can anyone know this.

what is the difference between varchar(50),varchar(MAX),nvarchar(100),varbinary(100)?
Posted

Varchar is not Unicode
Nvarchar is Unicode
(size) defines the maximum length of the filled
(max) defines thisnlengthnto be the maximum allowable for that type (about 8000 chars for varchar)
Varbinary holds binary data rather than ASCII or Unicode.

The 'var' bit is an indication that the actual space taken up for the fild is variable I.e. if you store "abc" in a varchar(100) it doesn't take up 100 bytes of storage , rather it takes a little over three.
 
Share this answer
 
varchar is collation sensitive character string (1 byte per character) nvarchar is a unicode string (2 bytes per character)

The number in the parenthesis is the size of the string.

MAX is a new keyword (post sql 2005) which is a variable length of unlimited size string.
 
Share this answer
 
Hi,

Varchar is not Unicode and takes 1 byte per char
Nvarchar is Unicode and takes 2 byte par char

Max takes maximum size, it can have.

VarBinary stores value in bit format (0 or 1), it is mainly used for security.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900