触发并禁用“受影响的行”。信息 [英] Triggers and disabling "row(s) affected" message
问题描述
我有一个触发器类型INSTEAD OF插入,更新。
如下所示:
I have a trigger type INSTEAD OF Insert, Update. It looks something like below:
IF EXISTS(some select staement)
updade
set
where
ELSE IF (some other select staement)
insert
values
ELSE--(3)
RAISERROR ('msg',16,1)
RETURN; SET NOCOUNT ON;
问题是,在第3个 else选项中,我只想显示错误消息,不显示任何内容受影响的行消息。
设置NOCOUNT ON对我不起作用。我已经尝试过不同的配置,请将其配置为有无返回。在声明中,我无所事事。
在任何地方都无法使用。我使用SQL Server 2005,有人可以帮助我吗?
行受影响的按摩应始终出现。唯一的例外是else语句。
The issue is that in 3rd - "else" option I would like to show only error message without any "row(s) affected" message. SET NOCOUNT ON dosen't work for me. I've already tried different configurations, put this with and without return. I was putted it everywhere in my statement. It doesn't work anywhere. I use SQL Server 2005 Can anybody help me please? Rows affected massage should appear always. The only exception is else statement.
推荐答案
使用 SET NOCOUNT ON ;
在查询之前,然后使用 GO
Use SET NOCOUNT ON;
before a query and then use GO
SET NOCOUNT ON;
GO
这篇关于触发并禁用“受影响的行”。信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!