1. 程式人生 > >循環更新sqlserver數據庫表ID

循環更新sqlserver數據庫表ID

cat etc sqlserver pen close gin lar while col

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

循環更新sqlserver數據庫表ID