
DROP TRIGGER LD0T0F_BVK_DEL;

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

CREATE TRIGGER LD0T0F_BVK_DEL ON LD0P0F
AFTER DELETE
AS 
BEGIN
SET XACT_ABORT ON
SET NOCOUNT ON
    IF EXISTS (SELECT * FROM LD0P0BVK WHERE OBJEKTID = 7053 AND OBJEKTNR IN (SELECT CONVERT(VARCHAR,BETALNR ) FROM DELETED))
    BEGIN 
        DELETE FROM LD0P0BVK
          WHERE OBJEKTID = 7053
            AND OBJEKTNR IN (SELECT CONVERT(VARCHAR,BETALNR ) FROM DELETED)
    END
END;

