declare @i int set @i=0 update tb set [ID]=@i,@i=@i+1 转载于:https://www.cnblogs.com/tohen/p/4193533.html