List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:April 20 1999 5:16pm
Subject:Re: varchar changing chars to varchars
View as plain text  
efrazier@stripped wrote:
> 
> Hi,
> 
> A while ago when asking about ALTER TABLE I was told that changing a field
> from char to varchar will result in the other chars in that table being
> converted to varchars, which it certainly seemed to have done, but when the
> table was made that way in the first place it at least looks like it is
> allowed. I just noticed I have a table that has varchar and chars at the
> same time. I thought this was not possible?
> 
> mysql> explain Section_numbers;
> +---------+--------------+------+-----+---------+-------+
> | Field   | Type         | Null | Key | Default | Extra |
> +---------+--------------+------+-----+---------+-------+
> | Chapter | char(3)      | YES  |     | NULL    |       |
> | Section | smallint(6)  |      | PRI | 0       |       |
> | Name    | varchar(100) |      | MUL |         |       |
> | Type    | char(3)      |      | MUL |         |       |
> +---------+--------------+------+-----+---------+-------+
> 
> Thanks,
> 
> Eric
> 

Maybe it is possible, but it better in most instance to
split your table into two parts - one with fixed length
columns and the other with variable length. It will
speed up a lot of queries by a great deal. And if you
can find a way to replace a char with an int, especially
in a key field, do it by all means, you queries are
going to fly!

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
varchar changing chars to varcharsefrazier20 Apr
  • Re: varchar changing chars to varcharsSasha Pachev20 Apr
  • Re: varchar changing chars to varcharsPaul DuBois20 Apr