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

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

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.