Updating a view sql server
View Implementation Rules Understanding the basic features of views will provide a framework for you to develop rules governing view usage.This section provides the rules of thumb for when it is wise to create views.The data "in the view" is not stored anywhere and only physically exists in the underlying tables. Views that access multiple tables can only modify one of the tables in the view.Views that use functions, specify DISTINCT, or utilize the GROUP BY clause may not be updated.The text of any view can be retrieved from the SQL Server system catalog using the system procedure sp_helptext (unless the view was created specifying WITH ENCRYPTION).For example, this statement: sp_helptext Sample_view Might return the following output: It is also possible to rename a view using the system procedure sp_rename.
id Data, -- PK of main table tab Data fi SL, fi Model, fi Claim Status -- FK to dim Claim Status FROM tab Data AS d INNER JOIN loc SL AS sl ON SL = SL INNER JOIN loc GSP AS gsp ON GSP = GSP INNER JOIN loc Country AS c ON Country = Country INNER JOIN loc Market Unit AS mu ON Market Unit = Market Unit INNER JOIN mod Model AS m ON Model = Model INNER JOIN dim Claim Status AS s ON Claim Status = Claim Status INNER JOIN tdef Product Type ON Product Type = tdef Product Product Type LEFT OUTER JOIN tdef Service Level ON d.fimax Service Level = tdef Service Service Level LEFT OUTER JOIN tdef Action Code AS ac ON d.fimax Action Code = Action Code UPDATE tab Data SET fi Claim Status = (SELECT id Claim Status FROM dim Claim Status WHERE Claim Status Name = 'Awaiting auth.') WHERE fi Claim Status=(SELECT id Claim Status FROM dim Claim Status WHERE Claim Status Name = 'Approved') updatable in practice, due to limitations of the query processor's reasoning.View Overview Before discussing how best to implement views, let's review the basics of views.All operations on a SQL Server table result in another table.The SQL Server (Transact-SQL) UPDATE statement is used to update existing records in a table in a SQL Server database.There are 3 syntaxes for the UPDATE statement depending on whether you are performing a traditional update or updating one table with data from another table.