UPDATE VS4TInventory Set TInvRefNo4=TInvNo Where TInvTInTAlias='SALEOUTPOS' and (TInvRefNo4='' OR TInvRefNo4 is NULL)
GO
UPDATE VS4TInventoryMB Set TInMDescription=TinMTInvNo Where TInMTInTAlias='SALEOUTPOS' and (TInMDescription='' OR TInMDescription is NULL)
GO
UPDATE VS4TInventory Set TInvNo=TInvRefNo Where TInvTInTAlias='SALEOUTPOS' and TInvRefNo4=TInvNo and TInvRefNo<>'' and TInvRefNo is not null
GO
UPDATE VS4TInventoryMB Set TinMTInvNo=TInMTSODNo Where TInMTInTAlias='SALEOUTPOS' and TInMDescription=TinMTInvNo and TInMTSODNo<>''
GO
UPDATE VS4TInventoryMB Set TinMTInvNo=(select tinvno from vs4tinventory where VS4TInventory.tinvrefno4=VS4TInventoryMB.tinmdescription)
Where TInMTInTAlias='SALEOUTPOS' and TInMDescription=TinMTInvNo and (TInMTSODNo='' or TInMTSODNo is null)
GO