I want to randomly choose a row in a column and change the value. I’m not too sure where Rand function goes.
To be more specific, I have a table with names in it but I want to randomly select one of the names from the first name column and change it to a different name of my choosing using the UPDATE
and RAND()
function. What parameters do I need inside the parenthesis as well?
I am using SQL Server Express
I tried starting the code out with
UPDATE tablename
SET columnname = ‘new name’
WHERE RAND();
Aucun commentaire:
Enregistrer un commentaire