update vs4tinventoryMB set tinmsourceno=(select tinvrefno from vs4tinventory where tinmtinvno=tinvno) where tinmtintalias='BORROW'
GO
update vs4tinventoryMB set tinmsourceln=(select top 1 ttrmln from vs4ttrmb where ttrmttrdno=tinmsourceno and ttrmtpdtcode=tinmtpdtcode) where tinmtintalias='BORROW'
GO