Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we update real data in views?

Since i am new with sql server, my question is

  1. Can we update views?

  2. Can we update real table data in views?

like image 406
Jagz W Avatar asked Aug 31 '11 05:08

Jagz W


1 Answers

If you update a view you will actually be updating the underlying table. A view is nothing physical, just a representation of the data underneath it.

In most circumstances you can perform UPDATE statements via VIEWS as long as they're setup to cater for UPDATEs (you can read more about enabling views for UPDATES here: http://msdn.microsoft.com/en-us/library/25614805(v=vs.80).aspx ) but it's generally considered less-than-great practise to do so. It makes things become very convoluted so you'd have to have a good reason to be doing it that way.

like image 164
mal-wan Avatar answered Oct 15 '22 09:10

mal-wan