What is the difference between 'INSERT INTO TABLE' and 'INSERT INTO VIEW'
Hello Wanted to know your thoughts on this- What is the difference between 'INSERT INTO TABLE' and 'INSERT INTO VIEW' AND here view is not Indexed View and also not getting the data from 2 or more different tables. It is just SELECT Col1, Col2.... from TABLE What could be the possibel advantage of using INSERT INTO VIEW instead of inserting directly into table.
Effectively, no real difference. You're just inserting into a table no matter which way you go since a view is just a query, not the underlying data. The only thing you can do with a view that you can't do with a table is mask the columns on display if you wanted to hide calculated or nullable columns from the user. You can't hide columns that are not nullable unless you have a default value for them. But the only reason I could see to use something like this is if you had an app that exposed tables for direct insert, which is a horrible idea. You'd want to always have some type of application in front helping to ensure the cleanliness of the data.