--创建游标并赋值
declare T_cursor cursor for select inf.id as InfId, inf.name as InfName from cs_infos inf join cs_info_PublishPlans pp on inf.id = pp.infid where PublishTime <= @sysNowTime
open T_cursor
declare @infId uniqueidentifier
declare @infName nvarchar(max)
--开始遍历数据
fetch next from T_cursor into @infId, @infName
while @@fetch_status=0
begin
select @infName
fetch next from T_cursor into @infId, @infName
end
close T_cursor
deallocate T_cursor
open T_cursor
declare @infId uniqueidentifier
declare @infName nvarchar(max)
--开始遍历数据
fetch next from T_cursor into @infId, @infName
while @@fetch_status=0
begin
select @infName
fetch next from T_cursor into @infId, @infName
end
close T_cursor
deallocate T_cursor