Although Adaptive Server places no restrictions on retrieving data through views, and although Transact-SQL places fewer restrictions on modifying data through views than other versions of SQL, the following rules apply to various data modification operations:
update, insert, or delete operations that refer to a computed column or a built-in function in a view are not allowed.
update, insert, or delete operations that refer to a view that includes aggregates or row aggregates are not allowed.
insert, delete, and update operations that refer to a distinct view are not allowed.
insert statements are not allowed unless all NOT NULL columns in the underlying tables or views are included in the view through which you are inserting new rows. Adaptive Server has no way to supply values for NOT NULL columns in the underlying objects.
If a view has a with check option clause, all rows inserted or updated through the view (or through any derived views) must satisfy the view’s selection criteria.
delete statements are not allowed on multitable views.
insert statements are not allowed on multitable views created with the with check option clause.
update statements are allowed on multitable views where with check option is used. The update fails if any of the affected columns appears in the where clause, in an expression that includes columns from more than one table.
insert and update statements are not allowed on multitable distinct views.
update statements cannot specify a value for an IDENTITY column. The table owner, Database Owner, or a System Administrator can insert an explicit value into an IDENTITY column after setting identity_insert on for the column’s base table.
If you insert or update a row through a multitable view, all affected columns must belong to the same base table.
writetext is not allowed on the text and image columns in a view.
When you attempt an update, insert, or delete for a view, Adaptive Server checks to make sure that none of the above restrictions is violated and that no data integrity rules are violated.
Copyright © 2005. Sybase Inc. All rights reserved. |