This is faster and has lower transactional overhead:DECLARE @i intSET @i=1INSERT INTO TempPin([ID], [Number]) VALUES(@i, 'mystyring')WHILE @i < 1000000 BEGIN INSERT INTO TempPin([ID], [Number]) SELECT ID+@i, 'mystyring' FROM TempPin WHERE ID <= 1000000-@i SELECT @i=Max([ID]) FROM TempPinEND
I'd recommend a clustered index on the ID column if you don't already have one (clustered primary key is also fine). It should improve the performance.