title: Creating consistent integer from a string
body: <p>I have various strings in a table in SQL Server/Oracle db, like this:</p>
  
  <pre><code> String1  
   String2  
   String3             
  </code></pre>
  
  <p>I need to convert them in to positive integers say some thing like:   </p>
  
  <pre><code>String1 = 12  
  String2 = 25  
  String3 = 45    
  </code></pre>
  
  <p>I am not expecting the numbers in any order. Only requirement is number generated for one string should not conflict with other. Either new strings can be inserted into the table or old strings can be deleted. Now later if I do not have 2nd string instead there is a new string</p>
  
  <pre><code>String1 = 12    
  String3 = 45    
  String4 = 28    
  </code></pre>
  
  <p>Note that the number 25 generated for 2nd string earlier can not be used for the new string.
  Using extra storage (temp tables) is not allowed. I used row_number function but later on realized that the integers generated with this function will get changed when new strings are inserted (as order of strings will change)</p>
  
  <p>Note: My strings are 128 bit GUIDs.</p>
  
  <p>Note: If I am allowed to use a table (Unique Integer - GUID mapping) at my local server (not at client's machine), how can I make sure that new GUID strings are not allocated the integer assigned earlier ? </p>
  
  <p>Any inputs to solve this problem will be appreciated. </p>