June 4, 2003 at 5:56 am
Hi All,
I imported some rows from some other table by giving set Identity_insert on command, and droping my Primary Key, but after that i couldnot set my primary key as it's now containing duplicates.
Is there any way by which these duplicated identity rows can be reseeded, so that I can create the primary key again with Identity.
Thanks in advance
June 4, 2003 at 6:15 am
Hi Rahuul,
what about dropping the field, save, create a new int field and make it primarykey and identity and save again?
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 4, 2003 at 9:39 am
don't remove the pk. delete the rows and reimport them without set identity_insert to give them new values.
if that's not possible, you can remove the identity (Requires a table rebuild) and then "fix" the data. Once that is done, you could rebuild the table with a new seed value that doesn't create duplicates.
Steve Jones
June 4, 2003 at 8:35 pm
yes identity column can be reset as follows
DBCC CHECKIDENT (<TableName>, RESEED, <reseed value>)
AMIT KULSHRESTHA
SOFTWARE ENGINEER
NEW DELHI,INDIA
AMIT KULSHRESTHA
SOFTWARE ENGINEER
NEW DELHI,INDIA
June 4, 2003 at 10:41 pm
Hi All,
Thanks for the all your help, I recreated a field and set the identity column and Primary key, and it is all fine now!!!
Thanks much!
quote:
Hi Rahuul,what about dropping the field, save, create a new int field and make it primarykey and identity and save again?
Cheers,
Frank
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply