日期:2014-05-18 浏览次数:20596 次
ALTER TRIGGER Tr_user_count ON dbo.[User] for UPDATE AS BEGIN INSERT INTO [Count] (UserNum) select UserNum from [User] end --Try
------解决方案--------------------
ALTER TRIGGER Tr_user_count
ON dbo.[User] for UPDATE
AS
BEGIN
INSERT INTO Count (UserNum) (select UserNum from [User])
end
或者
INSERT INTO Count (UserNum) (select UserNum from inserted)
------解决方案--------------------
COUNT是SQL的关键字
你把COUNT加上[]看看
------解决方案--------------------
instead of 触发器是不执行触发触发器的操作,转而执行触发器内部定义的操作
for触发器实现执行触发触发器的操作,在执行触发器内部定义的操作,相当于after触发器
------解决方案--------------------
instead of UPDATE--
改为
for UPDATE
or
after update