Archive for November, 2009

db2 drop schema … please!

The best documented way to drop a schema in DB2 is the

   db2 "DROP SCHEMA <schema_name> RESTRICT"

command. This, however, requires that all objects in the schema have been dropped before DB2 will allow the schema to be dropped. This is somewhat inconvenient for ad-hoc testing and fortunately in DB2 9 one can now use the stored procedure admin_drop_schema:

   db2 "call admin_drop_schema('<schema_name>', NULL, 'ERRORSCHEMA', 'ERRORTABLE')

Simple enough, but it took me long enough to track this down that I thought it worth posting.