How do I bulk update a SQL table with random data in one step?
I have a large table where, for testing purposes, I want to update a column to a different random value in each row.
If I say:
update MyTable
set MyCol = Rand()*100
then the value is indeed random - but the same random number is applied to every line.
I could use a cursor to iterate and update each row, one by one, and this is obviously what I will return if necessary. But is there some SQL syntax that will update each row with a different random value in one condensed expression?
+3
source to share