Thread: Changing Column Type

Changing Column Type

From
Peter Atkins
Date:
All,

Is there a way to easily change the type of  column? Or do I have to drop
and create again.

From:
assignment_notes | character varying(255)

To:
assignment_notes | text

Thanks,
-p



Re: Changing Column Type

From
Kevin Brannen
Date:
Peter Atkins wrote:
> All,
> 
> Is there a way to easily change the type of  column? Or do I have to drop
> and create again.
> 
> From:
> assignment_notes | character varying(255)
> 
> To:
> assignment_notes | text

Do that kind of change will require creating a new table, copying the 
data, dropping the old table, renaming the new to the old.

If you were changing from varchar(20) to varchar(255), you could hack 
the system tables and be OK (or so I've read).  Going smaller is 
possible too, as long as your 110% sure you don't have any data bigger 
then the new smaller size (or you're taking your life into your own 
hands so to speak. :-)

HTH,
Kevin