# Sample SYSCS_CHECK_TABLE queries

This section provides examples that illustrate how to use the SYSCS_UTIL.SYSCS_CHECK_TABLE function in queries.

To check the consistency of a single table, run a query that is similar to the one shown in the following example:

    VALUES SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'FLIGHTS')

To check the consistency of all of the tables in a schema, stopping at the first failure, run a query that is similar to the one shown in the following example:

    SELECT tablename, SYSCS_UTIL.SYSCS_CHECK_TABLE(
        'SAMP', tablename)
    FROM sys.sysschemas s, sys.systables t
    WHERE s.schemaname = 'SAMP' AND s.schemaid = t.schemaid

To check the consistency of an entire database, stopping at the first failure, run a query that is similar to the one shown in the following example::

    SELECT schemaname, tablename,
    SYSCS_UTIL.SYSCS_CHECK_TABLE(schemaname, tablename)
    FROM sys.sysschemas s, sys.systables t
    WHERE s.schemaid = t.schemaid

Parent topic: Checking database consistency
Related reference
The SYSCS_CHECK_TABLE function
Sample SYSCS_CHECK_TABLE error messages