I have a .NET application that inserts data in a SQL Server database, and the load in SQL Server for inserting new data when application load is large is quite high.
From time to time I get in the SQL Server logs:
Error occured during bulk operation database. Operation had to be rolled back. Transaction was deadlocked on lock. Duplicate key was ignored
What does it mean especially that: Duplicate key was ignored ? I have logs where the duplicate key part is not present.
Is there a general solution for this kind of problems ?
Duplicate key was ignoredis a warning/informational message that occurs when theIGNORE_DUP_KEYoption is on for an index and there is an attempt to insert a duplicate value.It is not an error in itself. It seems that if a subsequent error does actually occur that the process is just writing all messages from that stream to the log including those that do not actually relate to any error.
I’ve seen similar behaviour with SQL Server Agent job histories.