SQL Server Inserting Into Views

Suppose we have a view that we can select to see the rows and columns of the underlying tables. The question is can you insert additional rows into a view and have them added to the base tables underneath? Here our sql statement will be something like INSERT INTO ViewByDepartment (column1, column2, column3) VALUES (‘abc’, 2318, ‘defg’)

Yes you can but only if it relates to only one base table.

If you want to test it you can start with begin tran and end with rollback tran in your script.

Leave a comment

Your email address will not be published. Required fields are marked *