Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way to recover rows which had not been inserted into a specified table due to 'Cannot insert duplicate identity column' error.
Can I recover these rows from log file .ldf.

Tools used: Sql Server 2008, DB with Recovery Model: Full
Posted
Comments
Prasad Khandekar 20-Mar-13 10:19am    
If you are not using transaction management and using row by row insert (say in a for loop) with autocommit as true then only the row for which you got an error will not be present in table. In case of autocommit = false you can issue a commit commnd to make other rows permanent.

1 solution

Is there any way to recover rows which had not been inserted into a specified table due to 'Cannot insert duplicate identity column' error.
No. Data was not saved and error was raised. There would be no way to recover any data that was not persisted because of the error condition.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900