Jan 3, 2014

Sql query to drop or delete all the tables of a database which has modified before the given date in sql server


Sql query or script to drop or delete all the tables of a database which has modified before the specified or given date in sql server

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

Sql query or script to drop or delete all the tables of a database which has modified after the specified or given date in sql server

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

1 comment: