exam questions

Exam 70-762 All Questions

View all questions & answers for the 70-762 exam

Exam 70-762 topic 1 question 164 discussion

Actual exam question from Microsoft's 70-762
Question #: 164
Topic #: 1
[All 70-762 Questions]

You have a view that includes an aggregate.
You must be able to change the values of columns in the view. The changes must be reflected in the tables that the view uses.
You need to ensure that you can update the view.
What should you create?

  • A. a DML trigger
  • B. a schema-bound view
  • C. a stored procedure
  • D. a DDL trigger
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
When you create a view, you must obey the following conditions in order to make the view updateable:
✑ The columns being modified in the view have to directly reference the underlying table columns. As a consequence, the view's columns being modified cannot be the result of an aggregate function or a computed column.
The only way to make data changes on a non-updateable view is by using INSTEAD OF DML triggers. This way you can use procedural code to overcome the limitation.
References:
https://www.mssqltips.com/sqlservertip/5984/sql-server-trigger-on-view-example/

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
SoupDJ
4 years, 7 months ago
INSTEAD OF trigger used on the view
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...