时间:2021-07-01 10:21:17 帮助过:4人阅读
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 --释放游标
sqlserver 游标
标签:begin end base next cursor dea arc nbsp name