ScriptDom / Microsoft.Build.Sql does not support SQL Server 2022 named WINDOW clause (SQL46010)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với ví dụ SQL Server 2022 được cung cấp và dotnet build, sau đó theo dõi cách ScriptDom phân tích mệnh đề WINDOW được đặt tên. Công việc hoàn tất khi dự án mẫu build thành công mà không có SQL46010 đối với cú pháp hợp lệ này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- 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:
- Create an SDK-style SQL project targeting
Sql160 - Add a stored procedure or view that uses the SQL Server 2022 named
WINDOWclause:
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
- Build the project with
dotnet build - 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];
- Ngôn ngữ chính
- GAP
- Star
- 277
- Fork
- 43
- Merge trung bình
- 6 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/SqlScriptDOM
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/SqlScriptDOM#228 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
microsoft/SqlScriptDOM#183 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
microsoft/SqlScriptDOM#226 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/SqlScriptDOM#225 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
microsoft/SqlScriptDOM#224 ·
Tất cả issue của microsoft/SqlScriptDOM
Issue tương tự
-
Add: New Channel Pop! Đang mởchannels:add check:passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
confluentinc/dbt-confluent#160 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
AstrBotDevs/AstrBot#10205 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100