UPDATE vs4tarvdocref SET TRDRCurDiscount=0 WHERE TRDRCurDiscount is null
GO
UPDATE VS4TARVoucherPay SET TRVRAmount=0 WHERE TRVRAmount is null
GO
UPDATE VS4TARVoucher SET TRVHDiscount=((select isnull(sum(TRVRAmount),0) from VS4TARVoucherPay where TRVRReceiveType='DISCOUNT' AND VS4TARVoucherPay.TRVRTRVHNo=VS4TARVoucher.trvhno) +
(select isnull(sum(TRDRCurDiscount),0) from vs4tarvdocref where vs4tarvdocref.TRDRTRVHNo=VS4TARVoucher.trvhno))
GO
UPDATE VS4TARVoucher SET TRVHDiscount=0 WHERE TRVHDiscount is null
GO