* Pushkar Pradhan > I'm trying to enforce one column of my table to contain strictly 6 chars. > string. However I've some columns of type VARCHAR (e.g name, etc.) so > mysql silently changes the column to VARCHAR.
It is ok for MySQL. You can find some info here : http://www.mysql.com/doc/en/Silent_column_changes.html "... a.. If any column in a table has a variable length, the entire row is variable-length as a result. Therefore, if a table contains any variable-length columns (VARCHAR, TEXT, or BLOB), all CHAR columns longer than three characters are changed to VARCHAR columns. This doesn't affect how you use the columns in any way; in MySQL, VARCHAR is just a different way to store characters. MySQL performs this conversion because it saves space and makes table operations faster. See section 7 MySQL Table Types. ..." > Is there any way I can force the column to contain only 6 chars. No. But do you actually need it?! Mikhail. ----- Original Message ----- From: "Roger Baklund" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Pushkar Pradhan" <[EMAIL PROTECTED]> Sent: Thursday, August 15, 2002 9:46 AM Subject: Re: sql > * Pushkar Pradhan > > I'm trying to enforce one column of my table to contain strictly 6 chars. > > string. However I've some columns of type VARCHAR (e.g name, etc.) so > > mysql silently changes the column to VARCHAR. > > Right. > > > Is there any way I can force the column to contain only 6 chars. > > Yes, you can define it as VARCHAR(6)...? > > -- > Roger > sql > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php