ALTER PROCEDURE [dbo].[PoliciesGetSuspenseAmount] >>( >> @PolicyHeaderPK uniqueidentifier, >> @SuspenseAmount decimal(18,2) OUTPUT >>) >>AS >> SET NOCOUNT ON; >> SELECT >> @SuspenseAmount = COALESCE(SUM(AmountReceived), 0.00) >> FROM [dbo].[ReceiptDetails] >> inner join [dbo].[Receipts] on ReceiptFK = ReceiptPK >> WHERE >> ([PolicyHeaderFK] = @PolicyHeaderPK >> AND ReceiptTypeFK = 4)>>
>coalesce(cast(sum(AmountReceived as decimal (18,2)),0)I tried changing it to this:
SELECT @SuspenseAmount = cast(COALESCE(SUM(AmountReceived), 0.00) as decimal)and that didn't work either. I've now got it returning 70.00 instead of 70, but it should be 69.57.