Martin,
> two questions.
> When should I use one, and when the other?
IMHO, CHAR serves three purposes:
1. It is a good data type for fixed-length abbreviations that will never
be more or less than the number of characters intended. US state codes,
for example, which are always exactly two characters (Unless you count
Puerto Rico and the Virgin Islands!)
2. SOmetimes you have a field which is *almost* always the same exact
length, and needs to be used extensively in JOIN operations. In that
case, the 2-byte savings of the CHAR data-type over VARCHAR may make a
difference.
3. Converting several VARCHAR columns to CHAR and then concatinating
them (||) will give you a quick-and-easy fixed-width multi-column format
for list boxes and the like.
Otherwise, always use VARCHAR. You won't need to worry about trailing
spaces or fields being equal to a bunch of blanks (' ').
> Which is the limit on CHAR(n) and VARCHAR(n)?
Limit? There's a limit?
Ask Stephan. I'm pretty sure it varies by distribution, but is
somewhere in the thousands.
-Josh Berkus
--
______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete
informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small
businesses fax 621-2533 and non-profit organizations. San Francisco