DF027: The RAISERROR statement with the NOWAIT option is used in trigger.

Last modified: December 25, 2024

The topic describes the DF027 T-SQL code analysis rule.

Category

PERFORMANCE

Message

The RAISERROR statement with the NOWAIT option is used in trigger.

Description

Do not use the RAISERROR statement with the NOWAIT option in triggers to avoid performance issues.

Additional information

This rule allows triggers to raise custom error messages without causing the calling process to wait for acknowledgment before continuing execution.

Noncompliant code example

CREATE OR ALTER TRIGGER DemoTrigger
ON dbo.DemoTable
FOR INSERT
AS BEGIN 
  RAISERROR('',10,-1) WITH NOWAIT;
END
GO

Compliant solution

CREATE OR ALTER TRIGGER DemoTrigger
ON dbo.DemoTable
FOR INSERT
AS BEGIN 
  RAISERROR('',10,-1);
END
GO