
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [KLIENCI_DELETE]
ON [dbo].[KLIENCI]
FOR DELETE 
AS

DECLARE @id INT
DECLARE @Klient nvarchar(50)
SELECT @id=CustomerId, @Klient=FirstName FROM deleted

-- zapis do logu
INSERT INTO dbo.[LOG](OPERACJA, TABELA, OPIS)
VALUES('DELETE', 'KLIENCI', 'ID: ' + CAST(@id AS varchar) + ' | Name: ' + @Klient + ' | User: ' + USER_NAME())


GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

