Internal Solution
First check that the error the customer is receiving includes the reference to the procedure: -
Procedure = spxCalculateActualUpperLimitPositionForDeferredPaymentAgreement
β
If so, running the following code will execute that stored procedure in a loop and the output will tell you which Deferred Payment Agreement(s) failed - the DPA ID will be the number before the error that is output.
β
DECLARE @DPAID int, @CalcID int DECLARE curDPA CURSOR FOR SELECT ID FROM DeferredPaymentAgreement OPEN curDPA FETCH NEXT FROM curDPA INTO @DPAID WHILE @@FETCH_STATUS = 0 BEGIN PRINT @DPAID BEGIN TRANSACTION EXEC spxCalculateActualUpperLimitPositionForDeferredPaymentAgreement @CalcID, null, @DPAID, 'Test' ROLLBACK TRANSACTION FETCH NEXT FROM curDPA INTO @DPAID END CLOSE curDPA DEALLOCATE curDPA
You will get an output similar to the below, with the number before the error being the DPA ID in error - in this example it is 520
519 520 Msg 8115, Level 16, State 6, Procedure spxCalculateActualUpperLimitPositionForDeferredPaymentAgreement, Line 70 [Batch Start Line 0] Arithmetic overflow error converting float to data type numeric. The statement has been terminated. 521 522
Then you can get the Client Reference by putting that ID in to this query
select cd.Reference from DeferredPaymentAgreement dpa join ClientDetail cd on dpa.ClientID = cd.ID where dpa.id=<DPA ID IN ERROR>
Then on inspection of that Service User's DPA, you should be able to see what the issue is - check for missing asset values, a backdated reassessment, the removal of the debt accrues to date.
