ahjesus sql手动重新更新ID

UPDATE [dbo].[TLotterySpiderRule] SET [Id] = 0

declare cus_cursor cursor scroll for 
SELECT Id from [dbo].[TLotterySpiderRule] 
open cus_cursor
declare @Id int
declare @count int
set @count=0
fetch next from cus_cursor into @Id
while @@FETCH_STATUS=0
begin
set @count=(@count+1)
print @count
UPDATE [dbo].[TLotterySpiderRule] SET [Id] = @count where id = @id
fetch next from cus_cursor into @Id
end
close cus_cursor
deallocate cus_cursor
原文地址:https://www.cnblogs.com/ahjesus/p/3638572.html