Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET IDENTITY INSERT [MyTable] ON
- SET IDENTITY INSERT [MyTable] OFF
- SELECT Field1, Field2 INTO #MyTable FROM MyTable
- TRUNCATE TABLE MyTable
- INSERT INTO MyTable
- (Field1, Field2)
- SELECT Field1, Field2 FROM #MyTable
- SELECT * FROM MyTable
- -----------------------------------
- ID Field1 Field2
- 1 Value1 Value2
- -- Reset the primary key counter
- dbcc checkident(ErrorCode, reseed, 7000)
- -- Move all rows greater than 8000 to the 7000 range
- insert into ErrorCode
- select Description from ErrorCode where ErrorCodeID >= 8000
- -- Delete the old rows
- delete ErrorCode where ErrorCodeID >= 8000
- -- Reset the primary key counter
- dbcc checkident(ErrorCode, reseed, 8000)
Add Comment
Please, Sign In to add comment