·
Any modifications, including UPDATE, INSERT, and DELETE statements, must
reference columns from only one base table.
·
The columns that are being modified in the view must reference the
underlying data in the table columns directly. They cannot be derived in any
other way, such as through:
·
An aggregate function (AVG, COUNT, SUM, MIN, MAX, GROUPING, STDEV,
STDEVP, VAR and VARP).
·
A computation; the column cannot be computed from an expression using
other columns. Columns formed using set operators (UNION, UNION ALL, CROSSJOIN,
EXCEPT, and INTERSECT) amount to a computation and are also not updatable.
·
The columns that are being modified cannot be affected by GROUP BY,
HAVING, or DISTINCT clauses.
·
TOP cannot be used anywhere in the select_statement of the view when
WITH CHECK OPTION is also specified.
Schema
Binding
Schema
binding ties an object to the base object that this new object depends upon.
So without schema binding if a view is created and the underlying table is
changed, the view may break, but the table change can still occur. With
schema binding, if the base object is bound to another object, you will not be
able to modify the based object unless you drop or alter the object to remove
the schema binding
So
if you want to create an index on a view or you want to preserve the base table
schema once a view has been defined, in both these cases you have to use the
"WITH SCHEMABINDING" clause to bind the view to the schema of the
base tables
you
must first create a unique clustered index on the view, before you can create
any non-clustered indexes.
·
You can not create an index on a view with outer joins used in it, even
if you use schema binding
·
You can not use '*' in the select statement of a view when it is schema
bound. In such case you will clearly get error message of level 15 as "Syntax
'*' is not allowed in schema-bound objects.".
·
You will not be able to create clustered index on a view if the view
references any nondeterministic functions.
·
You can not use aggregate functions when using schema binding.