CREATE TRIGGER [S_update]
ON [dbo].[TastDistribution]
AFTER UPDATE
AS
DECLARE @S_distributionStatus VARCHAR(50),@S_clientName VARCHAR(50)
,@S_yewuyuan VARCHAR(50)
SELECT @S_distributionStatus=distributionStatus,@S_clientName=clientName,
@S_yewuyuan=yewuyuan FROM UPDATED
IF(@S_distributionStatus='已分配')
BEGIN
INSERT INTO dbo.TastConnection VALUES(@S_clientName,'未联系',@S_yewuyuan,NULL,NULL)
END
触发器执行时没有语法错误,但是这个触发器执行后,表[dbo].[TastDistribution]就无法更新数据了,提示说“对象名updated无效”,我触发器不怎么懂,只是依葫芦画瓢,插入和删除的时候都是FROM INSERTED或DELETED,于是修改我也这样写了,求大神们指点!
|
|