I try to update my column with random number in sql server 2008 R2.
For example myTable is like below :
id password
1 NULL
2 NULL
3 NULL
4 NULL
4 NULL
5 NULL
5 NULL
5 NULL
When I update password by generating 5 digit random number, table be like
UPDATE myTable
SET password = CONVERT(numeric(5,0),RAND(convert(varbinary,newid()))*89999)+10000
id password
1 87781
2 15395
3 62154
4 74194
4 49599
5 54090
5 47287
5 63193
And, My problem is generating password for each id. Could help me about query which is giving that result :
id password
1 87781
2 15395
3 62154
4 74194
4 74194
5 54090
5 54090
5 54090
Aucun commentaire:
Enregistrer un commentaire