update vs4tarcard set tricflag2=(select tivotype from vs4tarinvoice where vs4tarinvoice.tivono=vs4tarcard.tricdocno) where trictype='I'
GO
DELETE FROM vs4tarcard where tricflag2=10 and trictype='I'
GO