Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi ,
I am using one store procedure for inserting data from one table to another with some condition, and we are calling the same Stored procedure from two SQL server jobs
Now we are facing issue like duplicate data insertion into table. We thinking of this causing because of same stored procedure is called by two SQL jobs, is it possible that same stored procedure executing in parallel from two SQL jobs?.If yes then could you please give us solution ton avoid duplicate entry into table.

Please provide me the solution ASAP it's urgent
Sergey Alexandrovich Kryukov 16-Jul-15 13:23pm    
Why not preventing duplicate entry in first place?

In the SP before you insert the data into the target database check to see if the data already exists first. Google for how to use "IF EXISTS" if you don't know the syntax for this.
Share this answer
You can use MERGE, it is much more safe to use. Existing rows will be updated if they already exist or nothing will happen if nothing changed. Check out the links below.[^][^]

Good luck!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900