cmorris1441 (4/20/2013)
Here is the not working DELETE trigger:
CREATE TRIGGER dbo.tr_num_rented_delete
ON dbo.customer_rentals
FOR DELETE
AS
BEGIN
UPDATE m
SET num_rentals = num_rentals - 1
FROM dbo.movies AS m
INNER JOIN inserted AS i
ON m.movie_id = i.movie_id;
END
GO
What am I doing wrong?
Thanks.
I haven't done any T-SQL myself but shouldn't you be calling the "deleted" MRT instead of "inserted"? In pl/sql I'd be calling :OLD instead of :NEW.
Dird