是主從表: (1)select t1.*,t2.* from tb1 t1(nolock),tb2 t2(nolock) where t1.Fid=t2.Fid and t1.Fdep=t2.Fdep and t1.Fdep='开发部' (2)(3)在觫發器中完成
(1)select A.*,B.* from tb1 A,tb2 B where A.Fid=B.Fid and A.Fdep=B.Fdep and A.Fdep='开发部' (2)delete tb2 where Fdep='开发部' delete tb1 where Fdep='开发部' (3)可以使用一个触发器来自动完成更新。
select * from tb1 where Fdept="開發部" union all select * from tb2 where Fdept="開發部"delete tb1 where Fdept="開發部" delete tb2 where Fdept="開發部"update tb1 set Fdept="技術部" where Fdept="開發部" update tb2 set Fdept="技術部" where Fdept="開發部"
1 .select * from tb1 where Fdept ='开发部' union select * ,null,null from tb2 where Fdept ='开发部' 2.create trigger tri_up on tb1 for delete as begin delete tb2 where tb2.dept='开发部' end go delete tb1 where dept='开发部' 3 create trigger tri_up on tb1 for update as begin update tb2 set dept='技术部'where tb2.dept='开发部' end update tb1 set dept='技术部'where tb1.dept='开发部'
(1)select t1.*,t2.* from tb1 t1(nolock),tb2 t2(nolock)
where t1.Fid=t2.Fid
and t1.Fdep=t2.Fdep
and t1.Fdep='开发部'
(2)(3)在觫發器中完成
where A.Fid=B.Fid
and A.Fdep=B.Fdep
and A.Fdep='开发部'
(2)delete tb2 where Fdep='开发部' delete tb1 where Fdep='开发部'
(3)可以使用一个触发器来自动完成更新。
union all
select * from tb2 where Fdept="開發部"delete tb1 where Fdept="開發部"
delete tb2 where Fdept="開發部"update tb1 set Fdept="技術部" where Fdept="開發部"
update tb2 set Fdept="技術部" where Fdept="開發部"
12,13 85没有重复的不显示,五十分钟!!!!!!!!!!!!!!
select * ,null,null from tb2 where Fdept ='开发部'
2.create trigger tri_up
on tb1
for delete
as
begin
delete tb2 where tb2.dept='开发部'
end
go
delete tb1 where dept='开发部'
3 create trigger tri_up
on tb1
for update
as
begin
update tb2 set dept='技术部'where tb2.dept='开发部'
end
update tb1 set dept='技术部'where tb1.dept='开发部'