how to create a view .is it possible to insert in view with example query.what is view why we use view
how to create a view .is it possible to insert in view with example query.what is view why we use view
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
selvi subramanianPosted Sep 14, 2012, 3:35 AM
Santhosh Kumar JayaramanPosted Sep 14, 2012, 2:23 AM
Table:
Create table emp
(EmpId Int,
EmpName varchar(100))
View:
CREATE VIEW emp_view AS
SELECT EmpId, EmpName
FROM emp
Now to insert into View:
INSERT INTO emp_view ( EmpId , EmpName ) VALUES (1,'Santhosh')
But you cannot insert into view if it has multiple tables like this. For that
you need to use Instead of trigger.
See the code here to know how to use Instead of trigger.
http://www.manjuke.com/2011/08/how-to-insert-data-using-sql-views.html