I have a step that produces the xml and the MERGE table 1 insert and update, if you run it oncefrom the application to operate normally but if you run several times simultaneouslyapplication from a session ends well and the rest with deadlocks.The procedure is inside a TRANSACTION from source code, used EF5.0 and Sql 2014 SP1 CU1. The procedure is as follows:ALTER PROCEDURE [dbo].[procedure] @var1 int, @var2 xml, @var3 intASBEGIN SET NOCOUNT ON MERGE TABLA AS destino USING( SELECT CampoTabla1 = @var1, CampoTabla2 = T.Item.value ('@V', 'char(2)') FROM @var2.nodes('/L/I') AS T(Item) )AS origen ON origen.Campo1 = destino.Campo1 AND origen.Campo2 = destino.Campo2 WHEN MATCHED THEN UPDATE SET destino.Campo3 = @var3, destino.Campo4 = 0 WHEN NOT MATCHED BY SOURCE AND destino.Campo1 = @var1 AND destino.Campo3 = 0 THEN UPDATE SET destino.Campo3 = @var3, destino.Campo4 = GETDATE() WHEN NOT MATCHED THEN INSERT (Campo1, Campo2, Campo3, Campo4, Campo5) VALUES (origen.Campo1, origen.Campo2, @var3, GETDATE(), 0); ENDI modified the MAXDOP parameter of the instance but still the same error. THE BBDD was read commited snapshot. The level of parallelism is at 0 (Unlimited) The MAXDOP is at 8, since the machine has more than 8 cores. How can I fix it, something happens to them. Greetings.
↧