Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update SQL Statement

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2002-12-20 : 01:20:09
What would the SQL statement look like for updating remote inventory levels (webinventory) based on local inventory levels (localinventory) These tables are related by catalog numbers.

Would this work?

Update WebInventory
SET WebInventory.onhand = localInventory.Onhand
FROM
LocalInventory
INNER JOIN WebInventory ON LocalInventory.catalog = RemoteInventory.catalog

Thanks in advance.



Edited by - RichardSteele on 12/20/2002 01:45:19

SamC
White Water Yakist

3467 Posts

Posted - 2002-12-20 : 08:27:56
Your statement looks like it would work fine.

Have you tried it?

Don't know if it matters, but what if there's a remote catalog that isn't matched in the local catalog? No update will occur for those items.

There are simple ways to address this using a left outer join to perhaps set those items.Onhand = 0 or NULL.

Sam

Go to Top of Page
   

- Advertisement -