Product Documentation

SQL Operations Guide

Previous Topic

Next Topic


Purge tables that do not exist on disk from system tables.


The stored procedure takes the following arguments:

  • table name - This is a matching pattern using the like predicate syntax considering an empty string ('') and '%' (match all). Only tables matching the pattern are affected.
  • mode - This parameter can be:

    0 - purge missing tables

    1 - purge missing tables if created outside SQL (not by the create table statement but "imported")

    2 - purge all tables created outside SQL (remove them from SQL but do not delete from disk)

Mode 2 depends on the server being compiled with #define ctSQL_TRACK_ORIGIN active. If this #define is not active, an error is returned.

The fact that fc_purge_db does not delete tables from disk does not depend on the SQL_OPTION DELETE_IMPORTED; it never deletes tables from disk.

This stored procedure produces a resultset containing the list of tables entitled to be purged for which the purging was not successful due to an error, which is reported in the "status" column.