17.10 - DELETE DATABASE and Error Tables - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
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.