Determine the duplicate record in the INTran table, and then delete the duplicate record. To do this, follow these steps:
1. In Microsoft SQL Server Management Studio, access the appropriate application database. Then, run the following statement to determine whether duplicate records exist in the INTran table.
SELECT InvtID, TranAmt, LineRef, RecordID, * FROM INTran WHERE BatNbr = '<XXXXXX>'
Note: In the statement, replace the <XXXXXX> placeholder with the batch number.
2. Review the results to determine whether duplicate records exist. If a duplicate record exists, run the following statement to delete it.
Note: The recordid to delete would be the HIGHER of the duplicate records.
Run this first:
Begin Transaction
Run this Next: DELETE FROM INTran WHERE BatNbr = '<XXXXXX>' and RecordID = <YYYYYY>
Note In the statement, replace the <XXXXXX> placeholder with the batch number. Replace the <YYYYYY> placeholder with the RecordID value of the record that you want to delete.
The delete should return 1 row
Run this last:
Commit transaction
If it does not delete just one row
Run this:
Rollback transaction
If you find more than one duplicate, you have to identify the recordid (unique) for the other duplicates and delete them by using the same procedure.