0

I have a little difficulty with SQL Server 2017.

We are creating a database for benchmarks of our software, the database consists of data such as people's home addressees, phone numbers and such. The problem I have is as follows:

I have several columns already filled with data. Now I have house numbers ranging from 1-100. And I am supposed to write a script that will insert a random number from that range if the home address is identical. So, if for e example "Baloon Street' occurs 2 times, then a random 2 numbers would be inserted, separate for each Baloon Street.

Dale K
  • 25,246
  • 15
  • 42
  • 71
  • 1
    What did you try so far? – otto Nov 28 '19 at 07:53
  • maybe this [how-do-i-generate-random-number-for-each-row-in-a-tsql-select](https://stackoverflow.com/questions/1045138/how-do-i-generate-random-number-for-each-row-in-a-tsql-select) will help – ankyskywalker Nov 28 '19 at 07:55
  • abs(checksum(newid())%100)+1. It gives random value from 1 to 100. – Max Zolotenko Nov 28 '19 at 07:58
  • Possible duplicate of [How do I generate random number for each row in a TSQL Select?](https://stackoverflow.com/questions/1045138/how-do-i-generate-random-number-for-each-row-in-a-tsql-select) – Amira Bedhiafi Nov 28 '19 at 08:45

0 Answers0