From: https://blog.csdn.net/weixin_42609389/article/details/126955029
begin declare @a int declare @temp varchar(50) set @a=1 declare order_cursor cursor for (select [CMID] from [Warehouse].[MT].[Customers]) open order_cursor fetch next from order_cursor into @temp while @@FETCH_STATUS = 0 begin update [Warehouse].[MT].[Customers] set CMCode=@a where [CMID]=@temp set @a=@a+1 fetch next from order_cursor into @temp end close order_cursor deallocate order_cursor end go
标签:set,temp,declare,游标,Server,cursor,SQL,order From: https://www.cnblogs.com/joeblackzqq/p/17029029.html