加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql server 用游标循环更新Gis记录的简单示例

发布时间:2020-12-12 08:01:51 所属栏目:MsSql教程 来源:网络整理
导读:感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编来看看吧。 SQL代码如下: ---------------------用游标 循环 更新Gis记录declare @id numeric(18,0)declare @i intset @i=0declare updateGis cursor for select C0058_ID from T0058_PointObjectGis whe
感兴趣的小伙伴,下面一起跟随编程之家 52php.cn的小编来看看吧。
SQL代码如下:

---------------------用游标 循环 更新Gis记录
declare @id numeric(18,0)
declare @i int
set @i=0
declare updateGis cursor for select C0058_ID from T0058_PointObjectGis where c0058_table='C0130_EnerBaseInfo'
open updateGis --打开游标
fetch next from updateGis into @id
while(@@fetch_status=0)
begin
update T0058_PointObjectGis set c0058_table='T0130_EnerBaseInfo' where C0058_ID=@id
set @i=@i+1
--取下一条记录
fetch next from updateGis into @id 
end
close updateGis
deallocate updateGis --删除游标
print('更新记录数------------>'+convert(varchar(50),@i))


---- 来自52php.cn 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读