ninic

导航

循环更新sqlserver数据库表ID

DECLARE @a INT
DECLARE aaa CURSOR for select columnID from LNDB_COLUMN_INFO where columnID BETWEEN 223899 AND 224003
OPEN aaa
FETCH next from aaa into @a
WHILE @@fetch_status=0
BEGIN
print @a
update LNDB_COLUMN_INFO SET columnID=@a-223910 where columnID=@a
FETCH NEXT from aaa into @a
END
CLOSE aaa
DEALLOCATE aaa

posted on 2018-09-27 10:52  ninic  阅读(403)  评论(0编辑  收藏  举报