ScriptDom / Microsoft.Build.Sql does not support SQL Server 2022 named WINDOW clause (SQL46010)

オープン
#229 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
sql
領域
databases

調査の方向性

まず、提供された SQL Server 2022 の例と dotnet build を使って失敗を再現し、次に ScriptDom が名前付き WINDOW 句をどのように解析するかを追跡します。この有効な構文に対して、サンプルプロジェクトが SQL46010 なしで正常にビルドできれば作業は完了です。

索引モデルが issue の本文から書いたものです。

説明

bug
  • SqlPackage or DacFx Version: Microsoft.Build.Sql 2.2.0 / 2.3.0-preview.2, Microsoft.SqlServer.DacFx 170.5.60-preview
  • .NET Framework (Windows-only) or .NET Core: .NET 10.0.302
  • Environment (local platform and source/target platforms): Windows 11 → SQL Server 2022 (Sql160)

Steps to Reproduce:

  1. Create an SDK-style SQL project targeting Sql160
  2. Add a stored procedure or view that uses the SQL Server 2022 named WINDOW clause:
CREATE PROCEDURE [dbo].[ExampleProc] AS
BEGIN
    SELECT
        ROW_NUMBER() OVER [win] AS [RowNum],
        SUM([Amount]) OVER [win] AS [RunningTotal]
    FROM [dbo].[Transactions]
    WINDOW [win] AS (PARTITION BY [AccountID] ORDER BY [TransactionDate]);
END
  1. Build the project with dotnet build
  2. Build fails with: Build error SQL46010: Incorrect syntax near 'OVER'.

Expected Behavior:

The project builds successfully. The WINDOW clause is valid, generally available T-SQL syntax that shipped with SQL Server 2022 (compatibility level 160), documented at:
https://learn.microsoft.com/en-us/sql/t-sql/queries/select-window-transact-sql

Actual Behavior:

Build error SQL46010: Incorrect syntax near 'OVER'.

The ScriptDom parser does not recognize the named WINDOW clause syntax and fails to parse the T-SQL.

Versions Tested:

Component Version Result
Microsoft.Build.Sql 2.2.0 ❌ Fails
Microsoft.Build.Sql 2.3.0-preview.2 ❌ Fails
Microsoft.SqlServer.DacFx 170.5.60-preview ❌ Fails
SQL Server (target) 2022 (16.x) ✅ Works
Target Platform (DSP) Sql160

Did this occur in prior versions? If not - which version(s) did it work in?

This has never worked in any version of DacFx or Microsoft.Build.Sql. The named WINDOW clause was introduced in SQL Server 2022 (November 2022) and the ScriptDom parser has not been updated to support it in any release since — including the latest preview (170.5.60-preview, August 2026).

This follows a pattern of SQL Server engine features shipping without corresponding ScriptDom/DacFx parser support, previously seen with IGNORE NULLS (#133) and GENERATE_SERIES (#105). Both were treated as bugs and resolved.

Impact:

Teams using the WINDOW clause for cleaner, DRY window function definitions are forced to rewrite all named window references as inline OVER (PARTITION BY ... ORDER BY ...) definitions. The workaround is functionally identical but more verbose and harder to maintain.

Workaround:

Replace named WINDOW references with inline OVER() definitions:

-- Instead of this (fails to build):
SELECT
    ROW_NUMBER() OVER [win] AS [RowNum],
    SUM([Amount]) OVER [win] AS [RunningTotal]
FROM [dbo].[Transactions]
WINDOW [win] AS (PARTITION BY [AccountID] ORDER BY [TransactionDate]);

-- Use this (builds successfully):
SELECT
    ROW_NUMBER() OVER (PARTITION BY [AccountID] ORDER BY [TransactionDate]) AS [RowNum],
    SUM([Amount]) OVER (PARTITION BY [AccountID] ORDER BY [TransactionDate]) AS [RunningTotal]
FROM [dbo].[Transactions];
主要言語
GAP
スター
277
フォーク
43
平均マージ
6日 17時間
マージ済み PR(30日)
3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/SqlScriptDOM のほかの issue

microsoft/SqlScriptDOM の issue をすべて見る

似ている issue

Databases の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。