I am encountering an issue while attempting to call a stored procedure from a .NET Framework application to a Microsoft SQL Server instance. The error message returned is: "Violation of PRIMARY KEY constraint 'PK_Mytable'. Cannot insert duplicate key in object 'dbo.Mytable'. The duplicate key value is (c026da75-0528-47a9-9117-124c6690ec4f, b4f0b604-d2e2-4ce0-b3a7-1973dce6f27d, acd220ec-85a0-4999-8ebc-e0b42ec2ae07, XXX-00007449-XX). Transaction (Process ID 181) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. The statement has been terminated."
Additional Details:
The stored procedure in question is being called from a .NET Framework C# application.
The records being inserted are unique; there are no duplicate records and 100% sure about it.
Both the business logic and stored procedure do not contain any transactional scope level.
When running the stored procedure directly in SQL Server, it executes without errors and produces the expected results.
At the time of execution, my application makes only one call to the stored procedure.
Thank you for your assistance.