lundi 22 mai 2017

How to update a field with random numbers using a seed?

Table image

I have to update all the rows of the TaxId column in my table with random numbers using the Primary Key (PK) as a seed.

I am not understanding how to use the PK as a seed?

UPDATE myTable
SET TaxID = abs(checksum(NewId()) % 10000)

I tried the above code on one record, and it updated the TaxId with a random number of ONLY 4 digits. How do I get it to update with 9 random digits?




Aucun commentaire:

Enregistrer un commentaire