Re: SQL datatype question
Dale E. Reed Jr. ( (no email) )
Fri, 14 Aug 1998 10:36:17 -0700
Josh Hillman wrote:
> Are there any benefits to using the MSSQL datatype of "CHAR" over
> "varCHAR"? From what I read in my book here, varCHAR is the same as CHAR
> except it uses potentially less memory because it doesn't tack on spaces to
> the end of data that does not fill the column size. So, the column width
> (data length) of the two following sets would be the same, but varCHAR data
> could take up less memory:
> If CHAR has no advantages over varCHAR, then why would it exist?
char is right padded with spaces to the size of the string. Handy
for displaying data in columner format.
varchar is a variable length char that is NOT padded.
AFAIK, they both take up the same amount of space in the database,
however, varchar will return less data over the wire on queries
(char returns all those spaces in the pad). Char is the old way of
doing things from the old SQL Days.
-- Dale E. Reed Jr. (firstname.lastname@example.org)_________________________________________________________________ IEA Software, Inc. | RadiusNT, Emerald, and NT FAQs Internet Solutions for Today | http://www.iea-software.com