>Hi,
>
>I have 2 tables in SQL server 'ordhead' and 'ordlines' related by idord.
>On relation there are cascading delete from ordhead to ordlines.
>Table ordlines have a trigger for insert, update and delete to update table 'stock' related by idsku.
>When I delete a line from table ordhead, by cascading, all lines from table ordlines are deleted. In delete trigger I receieve the deleted lines in cursor 'deleted'.
>
>In order to update table stock I need to update for all lines from cursor 'deleted'. How to do this? How to write the UPDATE statement?
>
Try
UPDATE StockTable
SET InStock = InStock + deleted.qty
FROM StockTable JOIN deleted ON deleted.ProductID = StockTable.ProductID
--sb--