--触发器 注册新用户时 UserInfo 的userid 插入 tbuser 的 id Create trigger myinsert_Admin on Admin for Insert as declare @UserID varchar(40) select @UserID =AdminName from inserted insert into UserInfo(userid) values(@UserID) --触发器 删除用户时 用户信息也删除 create trigger mydeledte_Admin on Admin --主动删除表 for delete as delete UserInfo--被动删除表 from UserInfo userinfo ,deleted d where userinfo.userid=d.AdminName