How to rename a table in Teradata?

Teradata Rename Table

We can rename the existing Teradata table using RENAME TABLE statement.We should have DROP privileges on the table to be renamed, and the appropriate CREATE privileges on its containing database or user.

Syntax for Rename a table in Teradata

If you want to change the table name, you can use the Rename table in Teradata

Example for Rename table in Teradata

In this example, we are renaming the Customer_txn table to Transaction_bkup table in the Banking_DB database.

  • Before renaming the table, we need to do the impact analysis such as how many jobs using this table, is there any other table depends on this table and so on. Otherwise it will create the failure or table doesn’t exist error in the dependent jobs. 
  • If the table is not accessed by any jobs, we can rename table with suffix as backup table.

Rename Teradata table if exists using Bteq

We can use the below BTEQ script to validate whether the table exists or not and then we can rename the table in Teradata.

Recommended Articles