Tambahkan kolom ID ke insert tabel temp

SELECT *, IDENTITY( int ) AS idcol
  INTO #newtable
  FROM oldtable
Shy Seal