DECLARE @Stmt NVARCHAR(MAX) SET @Stmt = '' SELECT @Stmt = @Stmt + 'DROP TABLE [' + s.name + '].[' + v.name + '];' FROM sys.tables v INNER JOIN sys.schemas s ON s.schema_id = v.schema_id EXECUTE (@Stmt) GO SELECT * FROM sys.tables GO
DECLARE @Stmt NVARCHAR(MAX) SET @Stmt = '' SELECT @Stmt = @Stmt + 'DROP TABLE [' + s.name + '].[' + v.name + '];' FROM sys.tables v INNER JOIN sys.schemas s ON s.schema_id = v.schema_id EXECUTE (@Stmt) GO SELECT * FROM sys.tables GO