谁帮我解决下,弄了好久,写个触发器
表A 表B
id department和 id DepName
当表A中department字段改变时引发表B DepName字段改变,使表B中的必须和表A中的保持一致
department是nvchar型的
哪位高手帮帮忙
表A 表B
id department和 id DepName
当表A中department字段改变时引发表B DepName字段改变,使表B中的必须和表A中的保持一致
department是nvchar型的
哪位高手帮帮忙
调试欢乐多
FOR UPDATE
AS
if update(dep)
begin
declare @tmp nvarchar(50)
declare @id int
select @id = id,@tmp= dep from deleted
update b set b.dep =(select a.dep from a where a.id = @id) where b.dep =@tmp
end