How to drop tables based on sys.objects

11年前
DECLARE @sql NVARCHAR(MAX);

set @sql = '';


SELECT @sql = @sql + '
DROP TABLE '
  + QUOTENAME(SCHEMA_NAME())
  + '.' + QUOTENAME(name) + ';'
FROM sysobjects
WHERE name LIKE '%U2000V1R6C02';

PRINT @sql;
-- EXEC sp_executesql @sql;