• Here is my finished code. I have more than one trigger do get the job done, but it is working now. To determine the appropriate value, is just by using code. Say 1000 will be the value of an item in the front end to delete, so everything with this value will have the same name. Everything is stored in the in this table is stored in the same column. The only way it it differentiates in the front end is by code. Exapmle Column 1 will store all the codes and column 2 all the string data.

    (INSERT INTO TABLE)

    NameID RoleID StringData

    3000 20008 LS

    3000 20009 LS

    2001 20007 Audi

    (INSERT FROM TABLE)

    ID NameID RoleID Login

    1 3000 20010 LukeS

    2 3000 20011 LukeS

    Where Table 1 RoleID = Table 2 RoleID.(All (T1)20008 = (T2)20010 and (T1)20009 = (T2)20011) Only for those codes. Its a bit confusing if youre not used to it

    DECLARE @PAMID int, @RoleID int,@NameID int, @Signature varchar(3),@MaxID int

    SET @PAMID = (

    SELECT

    MAX (PAT_ACCOUNT_MANAGER_ID)

    FROM

    PAT_ACCOUNT_MANAGER

    )

    SET @NameID = (

    SELECT

    NAME_ID

    FROM

    inserted

    )

    SET @RoleID = (SELECT

    CASE ROLE_TYPE_ID

    WHEN 20035 THEN 20009

    WHEN 20036 THEN 20008

    END

    FROM

    inserted

    )

    SET @Signature = (SELECT

    [signature]

    FROM

    PERSON p

    join inserted i ON p.login_id = i.LOGIN_ID

    )

    --SET @MaxID = (

    -- SELECT

    --MAX(PAT_ACCOUNT_MANAGER_ID)

    -- FROM

    --PAT_ACCOUNT_MANAGER

    -- WHERE NAME_ID = @NameID

    -- )

    BEGIN

    DELETE FROM NAME_ADD_FIELDS

    WHERE NAME_ID = @NameID

    AND NAME_FIELD_NUMBER = @RoleID

    END

    BEGIN

    INSERT INTO NAME_ADD_FIELDS

    SELECT

    @NameID,

    @RoleID,

    @Signature,

    NULL,

    NULL

    END