Saturday, July 18, 2009

How to drop All tables from Database.

hi.
we can drop all table in one database using single line Query.There is an undocumented procedure which is very useful in seach Operation which seems complecated at first site.

Here is how to use this Procedure to drop all tables.

Use DROPTEST
EXEC sp_MSforeachtable @command1="drop table ?"


we can change statements inside @command1 to perform different operation on all tables.

Thanks.