What should you do to prevent data modifications that do not conform to the WHERE clause?

You are a database developer. You plan to design a database solution by using SQL Server 2008. A database contains a view that has the following features:
* It contains a WHERE clause that filters specific records.
* It allows data updates.
You need to prevent data modifications that do not conform to the WHERE clause. You want to achieve this goal by using minimum effort. What should you do?

You are a database developer. You plan to design a database solution by using SQL Server 2008. A database contains a view that has the following features:
* It contains a WHERE clause that filters specific records.
* It allows data updates.
You need to prevent data modifications that do not conform to the WHERE clause. You want to achieve this goal by using minimum effort. What should you do?

A.
Create an INSTEAD OF trigger on the view.

B.
Create a unique clustered index on the view.

C.
Alter the view by adding the WITH CHECK OPTION clause.

D.
Alter the view by adding the WITH SCHEMABINDING clause.

Explanation:
WITH CHECK OPTION
Forces all data modification statements executed against the view to adhere to the criteria set within select_statement. When a row is modified through a view, the WITH CHECK OPTION ensures the data remains visible through the view after the modification is committed.



Leave a Reply 0

Your email address will not be published. Required fields are marked *