Updating a view in sql Vere videochatroom gratis

-If the view that is supposed to be updated is based on another view, the later should be updatable.

-If the definition of the view does not have any sub queries.

-If the view has not been defined using groups and aggregate functions.

-If the view does not have any distinct clause in its definition.

VIEW_METADATA Specifies that the instance of SQL Server will return to the DB-Library, ODBC, and OLE DB APIs the metadata information about the view, instead of the base table or tables, when browse-mode metadata is being requested for a query that references the view.

When a view is created by using WITH VIEW_METADATA, all its columns, except a timestamp column, are updatable if the view has INSERT or UPDATE INSTEAD OF triggers.

For more information, see the Remarks section in CREATE VIEW (Transact-SQL). If a view currently used is modified by using ALTER VIEW, the Database Engine takes an exclusive schema lock on the view.

, that is to say can the engine uniquely identify the row(s) to be updated and secondly are the fields updateable.

If your view has a calculated field or represents the product of a parent/child join then the default answer is probably no. in MS SQL Server and Oracle (to take just two examples) you can have triggers that fire when you attempt to insert or update a view such that you can make something that the server doesn't think updateable into something that is - usually because you have knowledge that the server can't easily infer from the schema. You can't update an aggregate column in a view for example.

Leave a Reply