List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:April 15 1999 11:11am
View as plain text  
efrazier@stripped wrote:
> HI,
> sorry this is a little pathtic, but I can't seem to get ALTER TABLE to work.
> Could someone please send me an example of something simple like how to
> change a column from a CHAR(255) to a VARCHAR(20). I don' care so much about
> renaming columns and so on just changing their types. Hopefully without
> distroying anything :)
> Thanks,
> Eric

Hi Eric

That's simple:
ALTER TABLE yourTableName CHANGE columnName columnName VARCHAR(20);

If your contents in the changed column is shorter or equal 20 chars you won't loose
anything. If its longer it will be truncated to20 characters.
You can test for this before changing with:
SELECT MAX( LENGTH(columnName) ) FROM yourTableName;


ALTER TABLEefrazier15 Apr
  • Re: ALTER TABLEChristian Mack15 Apr