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))
---- 来自jb51.cc
原文链接:https://www.f2er.com/mssql/530184.html