16.20 - DELETE DATABASE and Error Tables - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Detailed Topics

Teradata Database
Teradata Vantage NewSQL Engine
Release Number
March 2019
Content Type
Programming Reference
Publication ID
English (United States)

When you delete a database that contains an error table, the system drops the error table regardless of the containing database for its data table. The system also drops the rows for the error table in the DBC.ErrorTbls system table. For more information, see Teradata Vantage™ Data Dictionary, B035-1092.

You cannot delete a database that contains a data table with an error table that is contained by another database.

The remedy for this situation is as follows:
  • Find all the error tables that are defined on the tables in the database being deleted by using the following SELECT statement:
         SELECT  BaseTblDbName, BaseTblName, ErrTblDbName, ErrTblName
         FROM    DBC.ErrorTblsV
         WHERE   BaseTblDbName <> ErrTblDbName
         AND     BaseTblDbName = CurrentDBName;

    where CurrentDBName is the database name of the database being deleted.

  • Drop all error tables from the list produced by this query.
  • Resubmit the DELETE DATABASE statement.