At Netezza, you may NOT change datatype of a column with ALTER TABLE xxxx MODIFY COLUMN COL_1:
Allowed only to:
- Change a column name
- Change a column default value
- Only increase length of a VARCHAR column (not to decrease).
--- FAIL: Changing DATE to TIMESTAMP
/*ERROR [HY000] ERROR: ALTER TABLE: only varchar fields can be modified */
alter table XXX MODIFY COLUMN COL TIMESTAMP;
--- FAIL: Changing VARCHAR(5) to VARCHAR(4)
/*ERROR [HY000] ERROR: ALTER TABLE: varchar field size can only be increased */
alter table XXX MODIFY COLUMN COL3 VARCHAR(4 );
--- SUCCESS: Changing VARCHAR(3) to VARCHAR(5)
/* Start time 3/28/2014 11:25:00 AM, end time 3/28/2014 11:25:00 AM. */
/* Duration 0.0624004 sec. */
alter table XXX MODIFY COLUMN COL3 VARCHAR(5 );
- ALTER TABLE
Use the ALTER TABLE command to change the structure of an existing table. If the table is in use by an active query, the ALTER command waits until that query completes.
how to change bigint to varchar(100) ??
ReplyDeleteDo you have solution for this..?
DeleteThis comment has been removed by the author.
ReplyDelete