SQL Flow Field Guide

TRIGGER_NESTLEVEL

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

trigger context

What changes

Input
trigger nesting state
Output or change
int

Syntax at a glance

TRIGGER_NESTLEVEL ( [ object_id ] , [ 'trigger_type' ] , [ 'trigger_event_category' ] )

Work example

Inspect how deeply trigger execution is nested.

Run one statement that affects several rows and verify every inserted and deleted row is handled.

Check your work Set a justified recursion guard and test multi-trigger update paths.

Open Microsoft Learn for full syntax, permissions, and details for your version.