Now try to Insert some values Into the View or Delete values from it:

INSERTINTO vw_TestView(ID, F1, F2)

VALUES(2,'C','D'),(2,'C','H');

GO

DELETEFROM vw_TestView

WHERE F1 ='A';

GO

Here is the result:

Msg 4405, Level 16, State 1, Line 1View or function 'vw_TestTriggerView' is not updatable because the modification affects multiple base tables.Msg 4405, Level 16, State 1, Line 1View or function 'vw_TestTriggerView' is not updatable because the modification affects multiple base tables.

Now will make a trick - create an INSTEAD OF Trigger:

CREATETRIGGER trg_TestView on vw_TestView

INSTEADOFINSERT

AS

BEGIN

INSERTINTO tbl_TestView_1(ID, F1)

SELECTDISTINCT
ID, F1 FROM inserted;

INSERTINTO tbl_TestView_2(ID, F2)

SELECTDISTINCT
ID, F2 FROM inserted;

END;

GO

Try to Insert:

INSERTINTO vw_TestView(ID, F1, F2)

VALUES(2,'C','D'),(2,'C','H');

GO

SELECT*FROM
vw_TestView;

GO

Here is the result:
ID F1 F2
----------- ---- ----
1 A B
2 C D
2 C H

Now modify trigger for Deletion:

ALTERTRIGGER trg_TestView on vw_TestView

INSTEADOFINSERT,DELETE

AS

BEGIN

DELETE t FROM tbl_TestView_1 as t

INNERJOIN deleted as d

ON t.ID = d.ID and t.F1 = d.F1;

DELETE t FROM tbl_TestView_2 as t

INNERJOIN deleted as d

ON t.ID = d.ID and t.F2 = d.F2;

INSERTINTO tbl_TestView_1(ID, F1)

SELECTDISTINCT ID, F1 FROM inserted;

INSERTINTO tbl_TestView_2(ID, F2)

SELECTDISTINCT ID, F2 FROM inserted;

END;GO

Try to Delete:

DELETEFROM
vw_TestView

WHERE F1 ='A';

GO

SELECT*FROM
vw_TestView;

GO

Here is the result:
ID F1 F2
----------- ---- ----
2 C D
2 C H

For a case when we do not need to delete records from the Parent table if the child table still have associated records we can modify trigger in this way: