Visual studio load test dependent operations concurrency issue RRS feed

  • Question

  • User166505692 posted

    I am working on a load test which has two requests/operations (Add/Delete). When I run load test I am getting primary key violation error as the add is triggered before delete operation for inserted user.

    As the requests are sent asynchronously delete is not using the same data what add is used. Is there any way to make delete use the same data what add used for the request and combine both operations or make delete dependent to add ?

    basically I am looking to make both operations one after another so that I won't see primary key violation error..

    Thursday, June 1, 2017 5:10 AM

All replies

  • User1967761114 posted

    Hi sbmdude,

    According to your description, I'm not clearly sure what did you want.

    The error was occurred by the primary key which you want to inserted has been exists, to avoid this issue, you could check whether the primary key has been exists before insert, you could refer to the following sql statements.

    INSERT INTO [dbo].[table](ID,[Column1],[Column2]) SELECT 1,'value1','value2' WHERE NOT EXISTS(SELECT 1 FROM dbo.[table] WHERE ID=1)

    If you have any other questions, please feel free to contact me any time.

    Best Regards


    Monday, June 5, 2017 5:15 AM