0
我有一個名爲order_details
的表和另一個表book_inventory
。SQL Server 2005觸發器不能正常工作
如果有時我quantity_ordered
在order_details
它應該從從quantity_in_stock
減少該值。
這裏是我的代碼:
create TRIGGER [dbo].[book]
ON [dbo].[order_details]
AFTER UPDATE
AS
IF UPDATE(quantity_ordered)
UPDATE book_inventory
SET book_inventory.quantity_in_stock = book_inventory.quantity_in_stock - order_details.quantity_ordered
FROM order_details
WHERE book_inventory.isbn = order_details.isbn
在哪裏的問題? – 2011-12-21 05:59:17
與此同時 - 您不在觸發器中使用INSERTED和DELETED別名 - 它的預期行爲? – 2011-12-21 06:00:22