I am trying to create a trigger that checks if the value after an update is 0 for a specific column. If the value is 0, the row should be deleted. I am not really familiar with triggers. I would apprecitate it if someone clould show/explain it to me. This is what I tried:
CREATE TRIGGER [dbo].[after_update]
ON [dbo].[tbl_LagerPos]
AFTER UPDATE
AS
BEGIN
DELETE FROM tbl_LagerPos WHERE Bestand = 0;
END
GO
Here Bestand is the one that should be checked if 0. If yes, then the whole row should be deleted. I know that this is checking the entire table and is basically wrong. So I need it for that specific record only.