Jeff Kring (3/3/2010)
I did look into ROW_NUMBER as an option. I could use it to return the correct rows, but the application needs the actual value as well.
Not sure if this is exactly what you mean, but it's quite easy to make a new table with a new identity column whilst copying an old identity column. Read the comments in the code, please...
--===== Original table with an IDENTITY column
SELECT TOP (1000)
IDENTITY(INT,1,1) AS SomeIdentity,
NEWID() AS SomeValue
INTO #ContainsIdentity
FROM Master.sys.All_Columns
--===== New table with new IDENTITY column and old
-- IDENTITY column stripped of IDENTITY property by ISNULL
SELECT IDENTITY(INT,1,1) AS SomeNewIdentity,
ISNULL(SomeIdentity,0) AS StrippedOfIdentity
INTO #NewTable
FROM #ContainsIdentity
--Jeff Moden
Change is inevitable... Change for the better is not.