Sybase IQ does not support alter table with change column data type functionality. I don’t know if this is the case with the new version (15). If you are using a version prior 15 you must do the following:
- First create a table similar to the source but with updated the column to the new data type.
create table tmp_old_table_name
/* unchanged column definitions here */
, old_column new_type
;
- Then we must copy the contents of the original table to the newly created one.
insert tmp_old_table
(/* column list here */)
select /* column list here */
from old_table
;
(/* column list here */)
select /* column list here */
from old_table
;
- Now that the data's there, create any other indexes you want.
;
- Drop or rename old table to backup
drop table old_table
;
;
- Rename new table to old table name
sp_rename tmp_old_table, old_table
;
;
No comments:
Post a Comment