更新随机字段

更新字段count,随机增加数值(解决了更新时增加的是同一随机数值问题)



update t_count set count=count+cast(ceiling(rand(checksum(newid()))*500) as int)

//count字段增加一个小于500的随机数
select * from t_count



UPDATE Article
SET Hit = Hit + CAST(CEILING(RAND(checksum(NEWID())) * 500) AS int)
WHERE (Id < 50)



UPDATE zhwj
SET 点击 = 点击 + CAST(CEILING(RAND(checksum(NEWID())) * 800) AS int)
WHERE (点击 < 100)

UPDATE [Case]
SET Hits = Hits + CAST(CEILING(RAND(checksum(NEWID())) * 800) AS int)
WHERE (Hits < 100)

UPDATE [yygk]
SET 点击 = 点击 + CAST(CEILING(RAND(checksum(NEWID())) * 800) AS int)
WHERE (点击 < 100)

你可能感兴趣的:(更新)