SQL Flow Field Guide

DBCC TRACEON

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

enables trace flags

What changes

Input
trace flag numbers
Output or change
session or global trace flags

Syntax at a glance

DBCC TRACEON ( trace# [ , ...n ] [ , -1 ] ) [ WITH NO_INFOMSGS ]

Work example

A supported diagnostic requires a documented trace flag in a controlled test.

Check SQL Server version guidance, scope, restart behavior, and rollback before enabling a flag.

Check your work Only the approved flag is active at the intended scope and the test has a stop condition.

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