Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#229 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
sql
Domain
databases

Research direction

Start by reproducing the failure with the provided SQL Server 2022 example and dotnet build, then trace how ScriptDom parses the named WINDOW clause. The work is done when the sample project builds successfully without SQL46010 for this valid syntax.

Written by the indexing model from the issue text.

Description

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];
Dominant language
GAP
Stars
277
Forks
43
Avg merge
6d 17h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/SqlScriptDOM

All issues in microsoft/SqlScriptDOM

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.