SQL 游标
declare @MId bigint
declare update_network cursor for --定义游标
select MerchantId from Sys_CCOO_Network
open update_network --打开游标
fetch next from update_network into @MId
WHILE @@FETCH_STATUS = 0 --执行循环
BEGIN
declare @packageId bigint=0
select top 1 @packageId=B.PackageId from sys_ccoo_order A join
Sys_CCOO_PurchaseRecords B on A.Id =B.corderId
join Sys_Product C
on C.Id=B.PackageId
and C.packageService=‘YWFW‘
where A.MerchantId=@MId
if(ISNULL(@packageId,0)>0)
begin
update Sys_CCOO_Network set defaultpackageId=@packageId where MerchantId=@MId
end
fetch next from update_network into @MId
END
CLOSE update_network --关闭游标
DEALLOCATE update_network --释放游标
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。