I'm facing a duplicate record problem; concurrency issue. I'm retrieving the record from database:
SELECT TOP 1 certid, certiname
FROM certificate
WHERE issued = 0
AND year = 2011
After retrieving the record I'm inserting the record different table by using a procedure...
There are multiple tables affecting that reason. I also used SQL transaction either affected all transaction or none, commit
or Rollback
. In this procedure I am also updating a certificate
UPDATE certificate
SET issued = 1
WHERE certid = @certid
but same certificate issued more than one policy..
How can I avoid this problem?