问题
I am working with a temporary table in Netezza that contains the columns id, gender, start_date, and end_date. I want to add a new column to this table that contains a default date of 2019-01-01 for all rows. The table to which I want to add this column is a local temp table, so ALTER TABLE does not work ("Error: Operation not allowed on a temp table"). To get around this, I created a new temp table as follows:
DROP TABLE new_temp_table IF EXISTS;
GO
SELECT id, gender, start_date, end_date, '2019-01-01' default_date
INTO TEMP TABLE new_temp_table
FROM old_temp_table;
GO
This new table is limited to 1000 rows by the SELECT...INTO
syntax. My old table has 36 million rows. Is there a solution that would allow me to directly modify the old table to add the new default date column, or some other way to get around the 1000-row limit with SELECT...INTO
?
来源:https://stackoverflow.com/questions/60250981/how-can-i-alter-a-temporary-table-with-36-million-rows-to-add-a-new-column