标签:begin end base next cursor dea arc nbsp name
n*(n+1)/2
DECLARE @name varchar(50);
DECLARE @code varchar(50);
DECLARE @z varchar(50);
DECLARE de CURSOR
for select name,code from base
open de
--fetch next from de into @name,@code
print ‘name1=‘+@name
set @z=‘ ‘
WHILE @@FETCH_STATUS = 0
begin
fetch next from de into @name,@code
set @z= @z+@name+‘ ,‘
end
print @z
close de --关闭游标
deallocate de --释放游标
标签:begin end base next cursor dea arc nbsp name
原文地址:https://www.cnblogs.com/xiaohuizhenyoucai/p/11443507.html