• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


28 Feb, 2025

Updated at 24 Mar, 2025

INSTEAD OF INSERT VIEW Trigger - Insert into table

I have a table test with columns ID, Text.

I have a view, testview, created from this table that mirrors test. The view populates data inserted into test, as expected.

I have another table, testDestination, that I want to insert into when the view is updated.

I have a trigger on testview as follows:

CREATE TRIGGER insertfromviewtest
   ON  testTriggerView 
   INSTEAD OF INSERT AS
BEGIN
    INSERT INTO testDestination (ID, Test)
    SELECT ID, Test
    FROM INSERTED
END

This trigger creates successfully. However, when I update the table test and the view updates, testDestination does not update.