Articles → SQL SERVER → Insert Data In View In SQL Server
Insert Data In View In SQL Server
Creating Table
Create A View
create view vw_Employee As
Select
EmployeeName,
[Description]
From
Employee E
inner join Designation D On E.Designation = D.[Description]
Create An Instead Of Trigger
CREATE TRIGGER TRG_EMPLOYEE_DESIGNATION ON vw_Employee INSTEAD OF INSERT AS BEGIN Insert into Employee (EmployeeName)
select
EmployeeName
From
Inserted Insert into Designation
select
[Description]
From
Inserted END
Insert Data Into View
insert into vw_Employee
values
('Gyan', 'Manager')
Output