exam questions

Exam 70-464 All Questions

View all questions & answers for the 70-464 exam

Exam 70-464 topic 1 question 7 discussion

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

You have an application that uses a view to access data from multiple tables.
You need to ensure that you can insert rows into the underlying tables by using the view.
What should you do?

  • A. Create an INSTEAD OF trigger on the view.
  • B. Define the view by using the SCHEMABINDING option.
  • C. Define the view by using the CHECK option.
  • D. Materialize the view.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
References:
http://msdn.microsoft.com/en-us/library/ms180800.aspx
http://msdn.microsoft.com/en-us/library/ms187956.aspx

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
mch185
4 years, 5 months ago
A is correct
upvoted 1 times
...
Williamzhou
4 years, 6 months ago
A is correct, as there are some restrictions to prevent from updating directly through view, but Instead of trigger doesn't have those kinds of restriction.
upvoted 1 times
...
Kepty
4 years, 7 months ago
It should be A (Instead of trigger)
upvoted 1 times
...
Luzix
4 years, 7 months ago
Views can be created in SQL Server WITH CHECK OPTION. WITH CHECK OPTION will make sure that all INSERT and UPDATE statements executed against the view meet the restrictions in the WHERE clause, and that the modified data in the view remains visible after INSERT and UPDATE statements. To test this, we will first create a table and insert some data in it: CREATE TABLE table_1 ( id int, data nvarchar(20) ) INSERT INTO table_1 VALUES (1, 'a'), (2, 'b'), (3, 'c') Next we will create a view using the WITH CHECK option: CREATE VIEW view_1 AS SELECT * FROM table_1 WHERE data like 'b%' WITH CHECK OPTION We can see only values in the data column that start with b: SELECT * FROM view_1 view_with_check_select_1 If we try to insert into view value that doesn't meet the WHERE criteria (WHERE data like 'b%'), it will fail: INSERT INTO view_1 VALUES (4, 'd')
upvoted 1 times
...
humba
5 years, 1 month ago
I think that the fact that the view is updating multiple tables makes creating an INSTEAD OF trigger a better option
upvoted 3 times
...
BigBen
5 years, 7 months ago
INSTEAD OF triggers can be created on a view to make a view updatable. The INSTEAD OF trigger is executed instead of the data modification statement on which the trigger is defined. This trigger lets the user specify the set of actions that must happen to process the data modification statement. Therefore, if an INSTEAD OF trigger exists for a view on a specific data modification statement (INSERT, UPDATE, or DELETE), the corresponding view is updatable through that statement. For more information about INSTEAD OF triggers, see DML Triggers.
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 ...