reference: Update a SQL Server Column with Random Numbers within a Range
UPDATE u SET student_id = ABS(CHECKSUM(NEWID())) % 1000000 + 9000000 FROM users u INNER JOIN course_users cu ON u.pk1 = cu.users_pk1 INNER JOIN course_main cm ON cu.crsmain_pk1 = cm.pk1 WHERE u.user_id LIKE 'xx%' AND cm.course_id = 'INT-Testcourse'