DROP TRIGGER LD0T0L_BVK_DEL;

REM---------------------------------------------------------
REM-- TRIGGER VID DELETE FRÅN LD0P0L
REM---------------------------------------------------------

CREATE TRIGGER LD0T0L_BVK_DEL ON LD0P0L
AFTER DELETE
AS 
BEGIN
SET XACT_ABORT ON
SET NOCOUNT ON
    IF EXISTS (SELECT * FROM LD0P0BVK WHERE OBJEKTID = 7220 AND OBJEKTNR IN (SELECT CONVERT(VARCHAR,RESURSNR) FROM DELETED))
    BEGIN 
        DELETE FROM LD0P0BVK
          WHERE OBJEKTID = 7220
            AND OBJEKTNR IN (SELECT CONVERT(VARCHAR,RESURSNR) FROM DELETED)
    END
END;

