title: How to generate a stable Primary Key
body: <p>I store a list of names in the database. The list does not have any primary key for each record. These names are then used by another program and so require a primary key to be used as a foreign key.</p>
  
  <p>The list is owned by a third party which is beyond our influence so we can't force them to provide a primary key.</p>
  
  <p>I was using an incremental number to have PK but it has recently been noticed that the new records can be inserted anywhere in the list and so the incremental approach would fail. Hash codes can not be used as they are not guaranteed to be stable.</p>
  
  <p>Is there any way i can generate a stable Primary Key for these records which can then be traced back with the name OR any other approach to refer back to a name in the list?</p>
  
  <p><strong>For example</strong></p>
  
  <p>On day 1 the list is like below</p>
  
  <ol>
  <li>Oliver</li>
  <li>Jack</li>
  <li>Harry</li>
  <li>Jacob</li>
  <li>Charlie</li>
  </ol>
  
  <p>Assume that 963 is the key (as hash code) for Oliver and this code has been saved by program XYZ in its storage to refer back to Oliver.</p>
  
  <p>On other day a new name Oscar has been added in the middle</p>
  
  <ol>
  <li>Oliver</li>
  <li>Jack</li>
  <li>Oscar</li>
  <li>Harry</li>
  <li>Jacob</li>
  <li>Charlie</li>
  </ol>
  
  <p>Now the key for Oliver is 852 because Hash code is not guaranteed to be stable and sequencing has been disturbed too hence the program XYZ can not refer back to Oliver using the key 963.</p>