I've created a table and I want to modify the datatype to one field from Char(4) to Char(5) but it is not possible....I tried to rename the column using the following statement and it was executed OK.
ALTER TABLE Table2
RENAME Desc_Catalog as Desc_Catalog_Tm, ADD Desc_Catalog CHAR(5)
and I've realized that the new field which is Desc_Catalog (which has the new datatype) does not contain any information at all. Is there any way that once the rename has been done the new field contain the data? I dont want to create a temporary table and once it has been created, pass the data from the temporary table to the new one.
Thanks in advance
that correct that you have renamed the column so Desc_Catalog_Tm contains data now and Desc_Catalog is empty. You cannot modify column datatype. You can add below statement after alter as you dont want temp tables
update table2 set Desc_Catalog= Desc_Catalog_Tm
Your syntax is also working fine at my end.
I could rename column name with data using your synax.