TR_CONSTITUENCYCODE_INSERTUPDATE_CONSTITUENCYCODESELECTION

Definition

Copy

create trigger dbo.TR_CONSTITUENCYCODE_INSERTUPDATE_CONSTITUENCYCODESELECTION
on dbo.CONSTITUENCYCODE
after insert,update
not for replication
as
begin
    declare @ID uniqueidentifier;
    declare IDCURSOR cursor local fast_forward for
        select
            ID
        from
            inserted;

    open IDCURSOR;
    fetch next from IDCURSOR into @ID;

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

    close IDCURSOR;
    deallocate IDCURSOR;
end