Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing old databases

Status
Not open for further replies.

uadmin

Technical User
Jun 13, 2001
122
GB
Good Morning,

Does anyone know of a fast way of removing more than one database at a time with the drop database < db_name> command.

Regards,
Simon

Simon Peter Wickham
Email: s.wickham@zoom.co.uk
 
1. Direct the output of the statement to file1.sql
unload to file1.sql
select name from sysmaster:sysdatabases where name not in ('sysmaster','sysutils','sysusers');

2. Prefix drop syntax
sed 's/^/drop database /' file1.sql > file2.sql

3. Substitute | with ;
sed 's/|$/;/' file2.sql > file3.sql

4. Review the statements (destructive in nature, be careful!) and execute it.
dbaccess - file3.sql
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top