Sometimes you want to clear out a database, but you can’t just drop the entire database and create a new one. Recently, a colleague needed to do just that, but couldn’t because the database was hosted elsewhere. Here is a simple script that works to drop all objects in any database I’ve tested it against so far. If your database contains object types that mine don’t, you might need to add to this script using the same patterns established here.
The following two tabs change content below.