Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
How to make views updateable in sql server while retrieving data from two tables.
The views in SQL Server are updateable by design. howerver there is some restrictions on th update operation it serlf:
- the columns modified must be from the same table- the column modified must be real columns (not the result of an aggregation or calculation).
If you have to do modification that don't respect the restrictions, you can create an "Instead Of" trigger to tel how the modification could be done
we requires UPDATE, INSERT, or DELETE permissions on the target table, depending on the action being performed.
By Using Sql management studio
in object explorer we can find views than expand views
then right click the view and select top 200 rows
The SQL UPDATE VIEW command can be used to modify the data of a view. All views are not updatable. So, UPDATE command is not applicable to all views. An updatable view is one which allows performing a UPDATE command on itself without affecting any other table.
CREATE VIEW Name AS SELECT colum_Name1,colum_Name2,colum_Name3,colum_NameN FROM table_Name WHERE colum_Name IN ('value_1','value_2');