|
---(XZH2000)
视图分可更新视图与不可更新视图,
如果视图是从一个表得来的,一般来说各种大型数据库都支持,
如果视图是从多个表得来的,一次只能修改其中的一个表MSSQL支持,ORACLE也可以。
修改视图一般使用instead of触发器。
create table a1(id int,name varchar(20))
craete table a2(id int,age tinyint)
go
create view v_a1_a2(id,name,age)
as
select a.id,a.name,b.age from a1 a,a2 b where a1.id=a2.id
go
create trigger tri_ins_v1
instead of insert
as
begin
insert into a1 select id,name from inserted
insert into a2 select id,age from inserted
end |
|