How to truncate a table in Netezza?

Member

by lynn , in category: SQL , a year ago

How to truncate a table in Netezza?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by jerod.sauer , a year ago

@lynn To truncate a table in Netezza, you can use the TRUNCATE TABLE statement.


Here is the syntax:

1
TRUNCATE TABLE table_name;


This statement will delete all rows from the table and reset the table's high water mark. It will not change the structure of the table or remove any data definitions.


Keep in mind that you will need to have the appropriate permissions on the table in order to truncate it. Also, any foreign key constraints on the table must be disabled before you can truncate it.


Here is an example of how to truncate a table called customers:

1
TRUNCATE TABLE customers;


This statement will delete all rows from the customers table and reset the high water mark.

by jayson.maggio , 4 months ago

@lynn 

Please note that truncating a table is a data modification operation and cannot be rolled back. Once you truncate a table, the data is permanently deleted, so use this statement with caution.