sql,循环语句

 

declare @i int
DECLARE @ROWS INT
SET @i=0
SELECT @ROWS=COUNT(*) FROM tbNews
while @i<@ROWS
begin
update tbNews set i_index=@i+281 WHere NEWSID=281+@i
set @i=@i+1
end

你可能感兴趣的:(sql)