只是说我在下面的触发器中有一个 throw 或 RaiseError
IF OBJECT_ID('Sales.OrderDetails_AfterTrigger', 'TR') IS NOT NULL
DROP Trigger Sales.OrderDetails_AfterTrigger;
GO
CREATE TRIGGER Sales.OrderDetails_AfterTrigger ON Sales.OrderDetails
AFTER INSERT, UPDATE
AS
BEGIN
IF @@ROWCOUNT = 0 RETURN;
SET NOCOUNT ON;
-- Check all rows
IF EXISTS(...)
BEGIN
RAISERROR ('This error message is not displayed', 10, 1 )
END
END
GO
如果在触发器中抛出 raiseerror 会阻止 dml 语句回滚吗?
只是我注意到发生这种情况时我仍在插入行。