TR_CONSTITUENCYCODE_DELETE_CONSTITUENCYCODESELECTION

Definition

Copy

create trigger dbo.TR_CONSTITUENCYCODE_DELETE_CONSTITUENCYCODESELECTION
on dbo.CONSTITUENCYCODE
after delete
not for replication
as
begin
    declare @ID uniqueidentifier;
    declare IDCURSOR cursor local fast_forward for
        select
            ID
        from
            deleted;

    open IDCURSOR;
    fetch next from IDCURSOR into @ID;

    while (@@FETCH_STATUS = 0)
    begin
        exec dbo.USP_CONSTITUENCYCODESELECTION_DELETE @ID;
        fetch next from IDCURSOR into @ID;
    end

    close IDCURSOR;
    deallocate IDCURSOR;
end