update vs4tarcard set triccancelstatus=(select trcncancelstatus from vs4tarcreditnote
where vs4tarcreditnote.trcnno=vs4tarcard.tricdocno and vs4tarcreditnote.trcntarncode=vs4tarcard.trictarncode)
where trictype='C'
GO
update vs4tarcard set triccancelstatus=1 where triccancelstatus is null
GO