declare @temp table 
( 
    [id] int IDENTITY(1,1), 
    [Name] varchar(10) 
) 
--select * from @temp 
declare @tempId int,@tempName varchar(10)

insert into @temp values('a') 
insert into @temp values('b') 
insert into @temp values('c') 
insert into @temp values('d') 
insert into @temp values('e')


--select * from @temp


WHILE EXISTS(select [id] from @temp) 
begin 
SET ROWCOUNT 1 
select @tempId = [id],@tempName=[Name] from @temp 
SET ROWCOUNT 0 
delete from @temp where [id] = @tempId

print 'Name:----'+@tempName 
end

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-02-28
  • 2022-12-23
  • 2021-09-11
  • 2021-06-17
猜你喜欢
  • 2022-12-23
  • 2021-07-26
  • 2021-11-16
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案