SQL pivoted table is read-only and cells can't be edited?

前端 未结 2 1544
野趣味
野趣味 2021-01-16 18:01

If I create a VIEW using this pivot table query, it isn\'t editable. The cells are read-only and give me the SQL2005 error: \"No row was updated. The data in row 2 was n

2条回答
  •  感情败类
    2021-01-16 18:20

    You'll have to create trigger on view, because direct update is not possible:

    CREATE TRIGGER TrMyViewUpdate on MyView
    INSTEAD OF UPDATE
    AS
    BEGIN
       SET NOCOUNT ON;
       UPDATE MyTable
       SET ...
       FROM INSERTED...
    END
    

提交回复
热议问题