Добавить столбец идентификатора в Temp Table INSERT
SELECT *, IDENTITY( int ) AS idcol
INTO #newtable
FROM oldtable
Shy Seal
SELECT *, IDENTITY( int ) AS idcol
INTO #newtable
FROM oldtable