Updates on PIVOTs in SQL Server 2008

后端 未结 4 2003
误落风尘
误落风尘 2021-01-07 10:11

Is there a way to perform updates on a PIVOTed table in SQL Server 2008 where the changes propagate back to the source table, assuming there is no aggregation?

4条回答
  •  没有蜡笔的小新
    2021-01-07 10:20

    PIVOTs always require an aggregate function in the pivot clause.

    Thus there is always aggregation.

    So, no, it cannot be updatable.

    You CAN put an INSTEAD OF TRIGGER on a view based on the statement and thus you can make any view updatable.

    Example here

提交回复
热议问题