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..
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.
Member
24 Points
178 Posts
Visual studio load test dependent operations concurrency issue
Jun 01, 2017 05:10 AM|sbmdude|LINK
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..
Member
520 Points
286 Posts
Re: Visual studio load test dependent operations concurrency issue
Jun 05, 2017 05:15 AM|EvenMa|LINK
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.
If you have any other questions, please feel free to contact me any time.
Best Regards
Even