Skip to main content

Problem:

Can be helpful for customers who would like to drop all tables for a specific Auth-Id, within a specific location.

Resolution:

Here's the steps to a trick your client can do:

DECLARE GLOBAL TEMPORARY TABLE DROPTAB (SQL VARCHAR(512));

INSERT INTO SESSION.DROPTAB

SELECT 'DROP TABLE ' || CREATOR || '.' || NAME || ';'

FROM SYSIBM.SYSTABLES

WHERE CREATOR = 'DB2CAS';

SELECT * FROM SESSION.DROPTAB;

Your client will have to replace my AUTHID of DB2CAS with their own value.  If the select shows a good list of tables to drop, an SQL script can be generated using the SQLWizard export feature.  Open a new export.  Choose "ASCII Delimited" as the format.  Enter SESSION.DROPTAB into the "Table name" text box.  Un-check the "Heading" and "Quote" check boxes.  Change the "Fld Delim" to a semicolon.  Change the extension on the "File Name" to SQL rather than FRE.  When the export is run, you should have an SQL script that will do the trick.  The SESSION.DROPTAB table will automatically be dropped when the user either executes COMMIT or exits SQLWizard.

Old KB# 2414

#MFDS
#EnterpriseDeveloper