UPDATE Student SET Student.StudentId = PersonalDetails.StudentId
FROM Student
INNER JOIN PersonalDetails on Student.UserId = PersonalDetails.UserId