请教SQL SERVER中DROP TABLE语句后面为Select查询结果时的写法
发布网友
发布时间:2024-10-11 09:01
我来回答
共2个回答
热心网友
时间:2024-11-24 12:54
select identity(int,0,1) id, name into #t from sys.objects WHERE object_id='1995154153'
declare @s int,@id int,@name varchar(10)
set @s=1
select @id =sum(id) from #t
while @S<@id
begin
select @name=name from #t where id=@s;
print @name
exec('drop table '+@name)
set @s=@s+1
end
热心网友
时间:2024-11-24 12:54
楼主后面解决了吗?在线求助啊 急!