3

ALTER TABLE table_name ADD column is not supported. Are there any other ways to add a column to a table?

1

1 Answer 1

10

You're quite wrong. Netezza supports adding columns. This is described in your Database Users Guide, B-19 section explains the ALTER TABLE syntax.

See the output from nzsql:

LABDB(ADMIN)=> CREATE TABLE REGION2 AS SELECT * FROM REGION;
INSERT 0 4
Elapsed time: 0m0.138s
LABDB(ADMIN)=> ALTER TABLE REGION2 ADD r_col1 char(8);
ALTER TABLE
Elapsed time: 0m0.145s
LABDB(ADMIN)=> SELECT * FROM REGION2;
 R_REGIONKEY |          R_NAME           |          R_COMMENT          | R_COL1
-------------+---------------------------+-----------------------------+--------
           4 | ap                        | asia pacific                |
           3 | emea                      | europe, middle east, africa |
           2 | sa                        | south america               |
           1 | na                        | north america               |
(4 rows)

Elapsed time: 0m0.510s
LABDB(ADMIN)=> UPDATE REGION2 SET r_col1 = 'AABBAABB';
UPDATE 4
Elapsed time: 0m1.256s
LABDB(ADMIN)=> SELECT * FROM REGION2;
 R_REGIONKEY |          R_NAME           |          R_COMMENT          |  R_COL1
-------------+---------------------------+-----------------------------+----------
           1 | na                        | north america               | AABBAABB
           3 | emea                      | europe, middle east, africa | AABBAABB
           4 | ap                        | asia pacific                | AABBAABB
           2 | sa                        | south america               | AABBAABB
(4 rows)

Elapsed time: 0m0.111s
LABDB(ADMIN)=>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.