Drop all tables in sql server database using ant script
Can anybody help开发者_高级运维 me with this?
I prefer if I don't have to explicitly list the table names.
Saw this before...
exec sp_MSforeachtable "DROP TABLE ? PRINT '? to be dropped' "
Source - http://sqlserver-qa.net/blogs/t-sql/archive/2008/05/20/4266.aspx
How about dropping the database? DROP DATABASE <database name>
Of course, that's rough on stored procedures, triggers, etc. But if the purpose is to eliminate all the tables in order to recreate them, it makes sense that you'd recreate all the other associated components as well, such as indexes.
精彩评论