---- Ëčíč˙ - AFTER UPDATE,DELETE ----
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OnËčíč˙Delete]') and xtype = N'TR')
drop trigger [dbo].[OnËčíč˙Delete]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AfterËčíč˙Update]') and xtype = N'TR')
drop trigger [dbo].[AfterËčíč˙Update]
GO
CREATE TRIGGER AfterËčíč˙Update ON [dbo].[Ëčíč˙] 
AFTER UPDATE,DELETE
AS
  if (SELECT Count(AddressID) FROM DELETED) > 0
    DELETE FROM Addresses WHERE 
      AddressID in (select AddressID from DELETED)
      AND ((select count(AddressID) from inserted) = 0 OR   
      AddressID not in (select AddressID from INSERTED))  
