开发者

Updating a column with random values between specific range?

I have a column where I need to update it's value b开发者_运维技巧y random numbers between 1 and 3150 (just being specific)

Can I do this with a simple TSQL statement?


Use RAND(), re-seeding the function on each call.

UPDATE MyTable
SET MyColumn = 1 + FLOOR(3150 * RAND(CONVERT(varbinary, NEWID())))
WHERE ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜