To identify which records are duplicated, run the following SQL into the directdebit database on the WebServices server:


SELECT pp.Reference ClientID,

   SUBSTRING(pp.DIBAN, 9, 6) AS SortCode,

   SUBSTRING(pp.DIBAN, 15, 8) AS AccountNumber,

   DAccountName,

   COUNT(*)

FROM [Application] app

INNER JOIN PaymentPlan pp

ON pp.AppId = app.ID

AND pp.[Status] = 0

WHERE app.AppName = 'StepChange DD Payers'

GROUP BY pp.Reference,

   SUBSTRING(pp.DIBAN, 9, 6),

   SUBSTRING(pp.DIBAN, 15, 8),

   DAccountName

HAVING COUNT(*) > 1


Once you have the information, email the CAM team ask them to investigate and remove the duplicate record.  Once the duplicate is fixed the job can either be re-ran by the DBA Team or left until it's overnight run (currently at 23:15)