SQL Flow Field Guide

ALTER DATABASE compatibility level

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

changes database compatibility level (no row flow)

What changes

Input
catalog
Output or change
catalog: database compatibility level

Syntax at a glance

ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = { 170 | 160 | 150 | 140 | 130 | 120 | 110 | 100 | 90 | 80 }

Work example

A database is being evaluated for compatibility level 170 or another supported level.

Compare Query Store plans and application results on a restored copy before changing production.

Check your work The selected level is supported by the engine and critical query plans meet their agreed limits.

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