문제

Here is my statement:

DELETE FROM table1 OUTPUT deleted.col1, deleted.col2 INTO view1;

It gives me this error:

The target 'view1' of the OUTPUT INTO clause cannot be a view or common table expression.

The view is simple and updatable. Why can I not insert into an updatable view using the OUTPUT clause?

도움이 되었습니까?

해결책

From MSDN - Output clause:

"The OUTPUT clause is not supported in the following statements:

  • DML statements that reference local partitioned views, distributed partitioned views, or remote tables.
  • INSERT statements that contain an EXECUTE statement.
  • Full-text predicates are not allowed in the OUTPUT clause when the database compatibility level is set to 100.
  • The OUTPUT INTO clause cannot be used to insert into a view, or rowset function.
  • A user-defined function cannot be created if it contains an OUTPUT INTO clause that has a table as its target. "
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 dba.stackexchange
scroll top