Reputation: 2419
Can any one explain in detail with an example if possible, why AFTER
triggers are not supported for views in SQL Server?
I know we use AFTER
triggers after insert
, update
or delete
on a table, then why not on a view, too?
Upvotes: 0
Views: 602
Reputation: 157048
Because it is only possible to do something instead of
an DDL statement on a view.
Views themselves don't contain data, so it is not possible to do something before or after a change since it can't be sure how one change on the view affects the data below it.
Example:
If you have a view resulting in one row, and you update that row, that row might disappear, 'another' row might pop up, and there is no way to tell the relation between the first and the last.
Upvotes: 5