UPDATE is not allowed because the statement updates view "table_name" which participates in a join and has an INSTEAD OF UPDATE trigger UPDATE is not allowed because the statement updates view "table_name" which participates in a join and has an INSTEAD OF UPDATE trigger sql-server sql-server

UPDATE is not allowed because the statement updates view "table_name" which participates in a join and has an INSTEAD OF UPDATE trigger


You can use MERGE to achieve this. Try:

MERGE INTO  sup_item  siUSING merch_cat_imp_sup_item AS mc        ON mc.sup_id = si.sup_id        AND mc.res_sup_item_id = si.sup_item_id        AND mc.cat_imp_event_id = @cat_imp_event_id        AND mc.accept_flag = 'y'        AND si.shi_flag = 'n'WHEN MATCHEDTHEN UPDATESET     name = mc.name,    sup_item_cat_id = mc.res_sup_item_cat_id,    xf_value = mc.xf_value,    ava_start_date = mc.ava_start_date,    ava_end_date = mc.ava_end_date,    status_code = mc.status_code,    last_mod_us_id = CASE WHEN mc.last_mod_us_id = 42 THEN @posting_us_id                      ELSE mc.last_mod_us_id END,    last_mod_tsp = CURRENT_tsp


The issue is not within your query. As per comments on your question, the entity you are updating [sup_item], isn't actually a table, it's a view. That view has an INSTEAD OF UPDATE trigger on it.

Are you able to post the SQL for the View and for the Trigger(s)?


I would also be interested, because I have a stored procedure in a database that I have inherited which tries to do this. It won't let me create the sproc in SQL 2014, but the fact that it is there in the sproc indicates to me that an earlier version of SQL server must have allowed this.