Re: column-type change
Posted in 1996
Topics: Data Types & Schema Design, Migration, Import/Export & Data Conversion
Thuc Nguyen wrote: > > How hard would it be to change a column from a char to a varchar? It > would go from a char(20) to a varchar(20) > > Is there a loss of the data if changed? > > I am on the informix engine 5.03 I haven't actually tried this, but there should be no loss of data. Quite the opposite. Remember the 1 char overhead; VARCHAR(20) will require upto 21 chars. So if your CHAR(20) are mostly full, then you will be forcing a large amount of data reorganisation. If it is a small table, I would recommend an unload/load with the MIN value for the VARCHAR set to the average size or more of your CHAR fields data. Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | The Informix FAQ is at http://www.iiug.org | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+