Reputation: 6281
I have a column where I need to update it's value by random numbers between 1 and 3150 (just being specific)
Can I do this with a simple TSQL statement?
Upvotes: 0
Views: 1915
Reputation: 8521
Use RAND()
, re-seeding the function on each call.
UPDATE MyTable
SET MyColumn = 1 + FLOOR(3150 * RAND(CONVERT(varbinary, NEWID())))
WHERE ...
Upvotes: 2