【发布时间】:2021-09-30 13:05:10
【问题描述】:
我需要在每次插入表之前执行一个查询。我尝试使用而不是
--insert into tbl_Exlog(ActionName) values('Insert')
--select * from tbl_Exlog
ALTER Trigger [dbo].[trgExLogTest] on [dbo].[tbl_ExLog]
Instead of Insert
as
begin
insert into tbl_ExLog (ActionName) values('trigger')
end
but it restricts the actual insert which I don't want.
输出: 动作名称 触发
插入丢失
【问题讨论】:
-
“它限制了实际的插入”这是什么意思?
-
我的意思是我需要执行这两个查询。 1. 插入前 2. 插入前
-
是的...为什么
INSTEAD OFTRIGGER会阻止你这样做?它没有。 -
发布您的实际尝试可能会告诉我们您在这里做错了什么。
-
我的触发器查询正在按预期执行。但是插入查询没有执行
标签: sql-server triggers