When I read through the delete portion of the INSERT, DELETE trigger DocumentBelongsToProduct I couldn't help but think, "that thing is whacky." Then I deleted a record like it shows in the book and it re-set every flag in the Production.Product table back to 0. Basically, the T-SQL on that portion is not right. The correct code to get that part working, at least in my minimal testing is this
Code:
SELECT @Count = COUNT(*) FROM Deleted
IF @Count > 0
BEGIN
UPDATE p
SET p.InformationFlag = 0
FROM Deleted d
JOIN Production.Product p
ON d.ProductID = p.ProductID
END
Put that in there instead of what's printed, and you can delete a record from the Production.ProductDocument and only that record will get the flag dropped off in the Production.Product table.
Donny Buckman