SQL/MX 3.2 Management Manual (H06.25+, J06.14+)

Table Of Contents
necessary and recompile them explicitly, as in “Steps for Dropping an SQL/MX Table and its
Data” (page 173).
A table that has an active DDL lock (one for which the process that created it still exists) cannot
be dropped even if you specify CASCADE. An active DDL lock will be released when the
utility locking the file completes.
If you specify RESTRICT and table is referenced by a view, a trigger, or a referential constraint
of another table, or if the table has an active DDL lock, the specified table cannot be dropped.
If you specify CASCADE, the table and all of its views, triggers, referential constraints, and
inactive DDL locks are dropped.
For more information, see the SQL/MX Reference Manual.
Steps for Dropping an SQL/MX Table and its Data
1. Start an MXCI session. Enter a LOG command to initiate a log file for statements and commands
entered in this session. Keep the log for your records.
2. Determine the name of the table you wish to drop.
3. Use the DISPLAY USE OF command to identify which user modules are associated with this
object. See the similarity check criteria in the SQL/MX Programming Manual for C and COBOL
to determine if your changes are likely to cause similarly check to fail and force automatic
recompilation. If they will, you should SQL compile these modules after making the changes
to avoid expensive automatic recompilations at run time. SQL applications that are running
while you make these changes will still undergo automatic recompilation.
For more information about explicit and automatic recompilation, see the SQL/MX Programming
Manual for C and COBOL. For more information about using DISPLAY USE OF, see “Checking
Module Dependencies with DISPLAY USE OF” (page 223) and the SQL/MX Reference Manual.
4. Enter the DROP TABLE statement.
5. Revise the application source code as needed to reflect your changes to the database. Process
and compile the updated source file. For more information, see the SQL/MX Programming
Manual for C and COBOL.
For more information, see the SQL/MX Reference Manual.
Recovering SQL/MX Tables Dropped Accidentally
If you drop a table accidentally, you can recover the table using the DDL file generated automatically
by NonStop SQL/MX. For more information, see “Using TMF to Recover Dropped SQL/MX Objects
(page 55) and the “Recovering Tables” (page 237).
Dropping SQL/MX Table Data Only
To drop data from a table while leaving the table intact, use the PURGEDATA utility.
PURGEDATA drops all data from both tables and their related indexes, or from specific partitions
of tables that have no indexes.
Guidelines for Dropping Table Data Only
To use PURGEDATA, you must have ALL privileges on the table you specify (DELETE, INSERT,
SELECT, and UPDATE) and you must own the schema, or you must be the super ID.
If PURGEDATA fails in response to a process, CPU, or system error, it uses the RECOVER utility
to recover the operation. If the PURGEDATA operation cannot be canceled, RECOVER returns
an error.
For more information, see “Using PURGEDATA to Delete Data From Tables” (page 207) and the
SQL/MX Reference Manual.
Dropping Objects From an SQL/MX Database 173