0

enter image description hereAm dropping all the table names in DB using

EXEC sp_MSforeachtable 'DROP TABLE ?'

Is there a way i can get count on number of tables dropped.

Thanks, Peru

user2067567
  • 3,695
  • 15
  • 49
  • 77

1 Answers1

1
DECLARE @before int;

SELECT @before = COUNT(*) FROM sys.tables;
EXEC sp_MSforeachtable 'DROP TABLE ?'
SELECT @before - COUNT(*) FROM sys.tables
gbn
  • 422,506
  • 82
  • 585
  • 676