SQL Flow Field Guide

SELECT - WINDOW clause

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

declares reusable named window specifications (PARTITION BY, ORDER BY, frame)

What changes

Input
window specifications
Output or change
named windows used by OVER clauses

Syntax at a glance

WINDOW window_name AS ( [ reference_window_name ] [ <PARTITION BY clause> ] [ <ORDER BY clause> ] [ <ROW or RANGE clause> ] )

Work example

A query needs a named window definition reused by more than one window expression.

Define partition and ordering once, then compare each expression that refers to the window.

Check your work SELECT - WINDOW clause. All expressions use the same named window rules and the detail row count stays unchanged.

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