Hello, I want to write an update query for using articles in an inventory module. Invent_header ID STOREID Invent_art table ARTID INVHEADID QTY_APP QTY_COUNT Stock Table ARTID STOREID STOCK Now I want to write an update query which updates the files QTY_APP in the invent_art table with the Stock field from the Stock table. Is it possible to write this in 1 query? Is so can someone help me out please. Thanks Ralph
you can update a single table in a update query but to perform it in atomic level you can use begin and commit tran.
Try something like this: UPDATE IA SET QTY_APP = ST.STOCK FROM Invent_Art IA JOIN Stock ST ON IA.ARTID = ST.ARTID WHERE <condition>
or u can Try something like this: UPDATE Invent_Art SET QTY_APP = ( select STOCK FROM Stock where Invent_Art.dbo.ARTID = Stock .dbo.ARTID) WHERE <condition>