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 ...
精彩评论