Updating a view mssql the unbearable lightness of dating

Posted by / 03-Jan-2017 10:00

Updating a view mssql

This may sound simple enough, but some developers have difficulties with the concept.Because of this, they tend to leave out is a table, so it is named just like any other table.

Assume you created the below view: The Answer lies on if the view is an UPDATABLE VIEW or a NON UPDATABLE VIEW.The view is a portion of data from the underlying tables.Provided that you have permissions, you can do the same data manipulation in views that you can do to a table directly.The view "Current Product List" lists all active products (products that are not discontinued) from the "Products" table.The SQL UPDATE VIEW command can be used to modify the data of a view.

updating a view mssql-52updating a view mssql-30updating a view mssql-73

--Create the tables create table Table1 (id int identity(1,1) primary key, f1 varchar(100)) create table Table2 (id int identity(1,1) primary key, Table1ID int, f2 varchar(100) CONSTRAINT FK_Table2_Table1 FOREIGN KEY (Table1ID) REFERENCES Table1(id)) --Insert some values insert into table2 select 1,'first row in T2' insert into table2 select 1,'second row in T2' insert into table2 select 2,'third row in T2' insert into table2 select 2,'fourth row in T2' --Create a view that joins the tables CREATE view v1 as select T1as T1ID, T2.