title: How to add a row number to new table in SQL?
body: <p>I'm trying to create a new table using an existing table already using:</p>
  
  <pre><code>INSERT INTO NewTable (...,...)
     SELECT * from SampleTable
  </code></pre>
  
  <p>What I need to is add a record number at the beginning or the end, it really doesn't matter as long as it's there.</p>
  
  <p><strong>Sample Table</strong></p>
  
  <pre><code>Elizabeth  RI 02914
  Emily      MA 01834
  </code></pre>
  
  <p><strong>Prospective New Table</strong></p>
  
  <pre><code>1 Elizabeth  RI 02914
  2 Emily      MA 01834
  </code></pre>
  
  <p>Is that at all possible?</p>
  
  <p>This is what I ultimately I'm shooting for... except right now those tables aren't the same size because I need my ErrorTemporaryTable to have a column in which the first row has a number which increments by the previous one by one.</p>
  
  <pre><code>declare @counter int
  declare @ClientMessage varchar(255)
  declare @TestingMessage carchar(255)
  select @counter = (select count(*) + 1 as counter from ErrorValidationTesting)
  while @counter &lt;= (select count(*) from ErrorValidationTable ET, ErrorValidationMessage EM where ET.Error = EM.Error_ID)
  begin
      insert into ErrorValidationTesting (Validation_Error_ID, Program_ID, Displayed_ID, Client_Message, Testing_Message, Create_Date)
      select * from ErrorTemporaryTable
  
      select @counter = @counter + 1
  
  end
  </code></pre>