title: Auto generating column value with respect to another column
body: <p>In my application when i insert data i have to generate sequential value for a particular column basing on value in other column. Is there any property which i could set in SQL Server 2005. </p>
  
  <p>I am explaining my requirement in more detail:</p>
  
  <p>I have table with two fields id and branchid, i have to insert sequential value for branchid automatically for every unique value of id</p>
  
  <p>That is</p>
  
  <pre><code>id   -  BranchId
  1    -    1,
  1    -    2,
  1    -    3,   
  </code></pre>
  
  <p>Now if i insert a row with id value 2, then branchid should automatically set with value 1</p>
  
  <p>Thanks and Regards
  Suraj.</p>