>I use Red Gate SQL Data Compare to duplicate my production data to a testing database. Basically it's a DELETE followed by a bunch of INSERTs. However, it seems to not reset the identity PK. I keep getting this error:
>
>{"Violation of PRIMARY KEY constraint 'PK_ApplicationNote'. Cannot insert duplicate key in object 'PreApplication.ApplicationNote'.\r\nThe statement has been terminated."}
>
>I know I can go in and run a script to reset the identity, but I have to do that on every table every time I do this. Does anybody know of a way to avoid this? Or a global way to reset all identity columns?
>
>Thanks!
If you are trying to copy the database exactly, use SET IDENTITY_INSERT ON before each table that has an identity column and SET IDENTITY_INSERT OFF after each. Copy the table data for primary key tables first.
____________________________________
Don't Tread on Me
Overthrow the federal government NOW!
____________________________________