I have a table with around 600000 records. I want to reseed the identity column of this table. Here's my plan:
So how do I store this table into a temp one?
If there is nothing else behind the scene then try this:
SET IDENTITY_INSERT TABLE_NAME ON
GO
UPDATE CTE
SET ID = RN
FROM
(
SELECT ID, ROW_NUMBER() OVER(ORDER BY ID) AS RN
FROM TABLE_NAME
) AS CTE
SET IDENTITY_INSERT TABLE_NAME OFF
GO
DBCC CHECKIDENT('TABLE_NAME', RESEED, 600001)
GO