How to create a view .is it possible to insert in view with example query.what is view why we use view
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Sep 13, 2012, 10:23 PM EDT
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
selvi subramanianRank #2,007 · 723 reputationPosted Sep 13, 2012, 11:35 PM EDT