how do you rename column in netezza which looks like - '?column?'?

1.3k Views Asked by At

How do you rename column in netezza table which looks like this '?COLUMN?'. I have already tried alter table with above but did not work .

1

There are 1 best solutions below

2
ScottMcG On

In order to reference a column name that starts with a question mark you will need to enclose the column name in double quotation marks.

TESTDB.ADMIN(ADMIN)=> create table test_table_1 ("?COLUMN?" BIGINT);
CREATE TABLE

TESTDB.ADMIN(ADMIN)-> \d test_table_1
             Table "TEST_TABLE_1"
 Attribute |  Type  | Modifier | Default Value
-----------+--------+----------+---------------
 ?COLUMN?  | BIGINT |          |
Distributed on random: (round-robin)

TESTDB.ADMIN(ADMIN)=> alter table test_table_1 rename column "?COLUMN?" to SOMETHING_ELSE;
ALTER TABLE

TESTDB.ADMIN(ADMIN)=> \d test_table_1
                Table "TEST_TABLE_1"
   Attribute    |  Type  | Modifier | Default Value
----------------+--------+----------+---------------
 SOMETHING_ELSE | BIGINT |          |
Distributed on random: (round-robin)