mssqlserver.当accountINFO表的accountID,password更新时,自动更新username表的相应信息,
在关系表中设计accountID为外键,并且级联删除更新,以下的就是password的触发改变
CREATE TRIGGER change_agent ON dbo.agentINFO
for UPDATE
AS
declare @password_i varchar(10)
declare @accountID_d varchar(10)
set @accountID_d=(select d.accountID from Deleted as d)
set @password_i=(select i.password from Inserted as i )
if UPDATE (password)
BEGIN
update username set password=@password_i where accountID=@accountID_d
end