UPDATE VS4TInventoryMB Set TInMAmount=0 WHERE TInMAmount is null
GO
UPDATE VS4TInventory Set TInvTotal=(SELECT SUM(VS4TInventoryMB.TInMAmount) FROM VS4TInventoryMB
WHERE VS4TInventoryMB.TInMShow=1 AND VS4TInventoryMB.TInMTInvNo=VS4TInventory.TInvNo)
WHERE TINVTInTAlias='BEGINBALANCE' AND TInvSourceType=9
GO
UPDATE VS4TInventory Set TInvTotal=0 WHERE TInvTotal is Null
GO