UPDATE ASET CompanyCode = b.CompanyCode FROM A a,B b where a.TaxNumber=b.TaxNumber and b.sysno is not null and a.CompanyCode!=b.CompanyCode