DECLARE @Table NVARCHAR(30)
DECLARE tmpCur CURSOR FOR
SELECT name FROM sys.objects WHERE TYPE=‘U‘ AND name LIKE N‘HSUPA%‘
OPEN tmpCur
FETCH NEXT FROM tmpCur INTO @Table
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @sql VARCHAR(100)
SELECT @sql = ‘drop table ‘ + @Table
EXEC(@sql)
FETCH NEXT FROM tmpCur INTO @Table
END
CLOSE tmpCur
DEALLOCATE tmpCur
时间: 2024-11-10 11:08:15