Using DB2 for VM and VSE System tables

Anyone with DBA authority can access the DB2 tables to list, display, transfer, or delete tables and views. Transferring ownership of a table or view is not recommended.

Listing tables and views

The query in Figure 108returns a list of tables from DB2 VM with columns TABLETYPE (R indicates a table, V indicates a view), TNAME (table name), TABESPACENAME, and REMARKS.

Figure 108. Listing DB2 tables and views owned by a particular user (VM)
SELECT TABLETYPE, TNAME, DBSPACENAME, REMARKS
   FROM SYSTEM.SYSCATALOG
   WHERE CREATOR = 'userid'
   ORDER BY TABLETYPE, TNAME

Deleting a table or view from the database

Use the SQL DROP TABLE statement or the QMF ERASE command to delete tables or views from the database. Only the creator of the table or someone with DBA authority can delete it.

When you delete the row of the SYSTEM.SYSCATALOG table that defines the table, all views, synonyms, and indexes associated with the table are also deleted. Before you drop a table from the database, ensure that no other user relies on it (for example, for command synonym or function key definitions).

[ Previous Page | Next Page | Contents | Index ]