Jan 3, 2014

Sql query to drop or delete all the tables of a database which has created before the given date


Sql query or script to drop or delete all the tables of a database which has created before the specified or given date

EXECUTE sp_MSforeachtable  @command1 = N'DROP TABLE ?', @whereand = N'AND create_date > 2011-12-30'

Sql query or script to drop or delete all the tables of a database which has created after the specified or given date

EXECUTE sp_MSforeachtable  @command1 = N'DROP TABLE ?', @whereand = N'AND create_date < 2011-12-30'

No comments:

Post a Comment