SQL Flow Field Guide

SET FMTONLY

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

returns only metadata, no rows (deprecated)

What changes

Input
none
Output or change
session state

Syntax at a glance

SET FMTONLY { ON | OFF }

Work example

A developer needs the diagnostic mode provided by SET FMTONLY without running the following workload by mistake.

Use a disposable connection and write down how to turn the mode off. Keep the mode out of application connection pools.

Check your work SET FMTONLY. The session returns to normal execution after SET FMTONLY is turned off and no later query was mistaken for a result.

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