双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

Sql语句 与 触发器的问题

程序小海 程序小海 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
一条sql语句
update bjmshelfmj set bjmshelfmj_test1=0
where mjbj_id=23 and moju_id=15

这条能触发表中的触发器

另一条sql语句:

update bjmshelfmj set bjmshelfmj_test1=0 where moju_id in
(1,15)
and mjbj_id=23

这条却不能触发表中的触发器

触发器为:

create trigger Tri_UpdateMjbjMf
on bjmshelfmj
after update
as
if(select count(*) from bjmshelfmj,inserted as i where
bjmshelfmj.mjbj_id=i.mjbj_id and
bjmshelfmj.mshelf_id=i.mshelf_id and
bjmshelfmj.bjmshelfmj_test1=1 )=0
begin
update bjmshelf set bjmsshelf_test1=0 from inserted
where bjmshelf.mjbj_id=inserted.mjbj_id and bjmshelf.mshelf_id=inserted.mshelf_id
end


请教各位是什么原因呢?

是不是 因为 in 这个范围的影响造成的?
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
程序小海
MS-SQL Server 34,876 成员 254,635 内容