Creating and Maintaining Databases

Creating a View

Before you create a view, consider these guidelines:

To create a view you must be granted permission to do so by the database owner and you must have appropriate permissions on any tables or views referenced in the view definition.

By default, as rows are added or updated through a view, they disappear from the scope of the view when they no longer fall into the criteria of the query defining the view. For example, a query can be created, defining a view that retrieves all rows from a table where the employee's salary is less than $30,000. If the employee's salary is increased to $32,000, then querying the view no longer displays that particular employee because his or her salary does not conform to the criteria set by the view. However, the WITH CHECK OPTION clause forces all data modification statements executed against the view to adhere to the criteria set within the SELECT statement defining the view. If you use this clause, rows cannot be modified in a way that causes them to disappear from the view. Any modification that would cause this to happen is canceled and an error is displayed.

The definition of a sensitive view can be encrypted to ensure that its definition cannot be obtained by anyone, including the owner of the view.

To create a view

Transact-SQL

Enterprise Manager

SQL-DMO

You can also create a view using the SQL Server Enterprise Manager Create View Wizard.

To create a view using the Create View Wizard

Enterprise Manager

Enterprise Manager

See Also

Modifying Data Through a View

SQL Views

View Resolution

Using Views as Security Mechanisms