title: TSQL- generate a sequence number for duplicate records
body: <p>Using SQL Server 2000, consider a source table with more than 400,000 records. </p>
  
  <p>The task is to select each <code>regno</code> entry with an incrementing on-the-fly <code>rowid</code> or sequence number for those with duplicates or multiple entries. For those which do NOT have duplicate entries in the source table, the <code>rowid</code> should simply be <code>null</code>.</p>
  
  <p>Here's an example of the desired output:</p>
  
  <pre>
      regno   rowid
      100      1
      100      2
      100      3
      200      null
      300      4
      300      5
      400      null
      500      null
      600      6
      600      7
  </pre>
  
  <p><strong>Question:</strong>
  What query would do the desired sequence incrementing using TSQL in SQL Server 2000?</p>