Click here to Skip to main content
11,584,622 members (64,960 online)
   

Database

 
Questionchar(255) vs varchar(255) vs varchar(MAX) Pin
devvvy1-Feb-13 18:22
memberdevvvy1-Feb-13 18:22 
I guess, the question is, why would I use

char(255)

instead of

varchar(255)

When I specify varchar(255), does SQL sever allocate [255] per cell? or does it allocate dynamically? If it statically allocate [255] bytes, then I don't see if there's much practical difference between char(255) and varchar(255) -- well, except varchar always store a one (or two) byte termination character internally.

If SQL server allocates 255 bytes when i specify varchar(255), then what about varchar(MAX)?

Thanks
dev

AnswerRe: char(255) vs varchar(255) vs varchar(MAX) Pin
Richard MacCutchan1-Feb-13 23:07
mvpRichard MacCutchan1-Feb-13 23:07 
GeneralRe: char(255) vs varchar(255) vs varchar(MAX) Pin
devvvy2-Feb-13 15:39
memberdevvvy2-Feb-13 15:39 
AnswerRe: char(255) vs varchar(255) vs varchar(MAX) Pin
PIEBALDconsult2-Feb-13 5:22
memberPIEBALDconsult2-Feb-13 5:22 
GeneralRe: char(255) vs varchar(255) vs varchar(MAX) Pin
devvvy2-Feb-13 23:30
memberdevvvy2-Feb-13 23:30 
GeneralRe: char(255) vs varchar(255) vs varchar(MAX) Pin
jschell3-Feb-13 6:36
memberjschell3-Feb-13 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150707.1 | Last Updated 7 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid