Provide a Built-in Function for Sequential Row Numbers in Query Output
まだ誰も着手していません。
評価
調査の方向性
issue にはファイル、テスト、エントリーポイントが記載されていません。まず、この samples repository に該当する SQL Server のサンプルまたは feature-request プロセスが含まれているか確認してください。完了には、payload で特定されていない、提案された関数の実装パスが必要です。
索引モデルが issue の本文から書いたものです。
説明
Description:
SQL Server should introduce a robust built-in function to generate a sequential row number for any query output, without requiring an explicit ORDER BY or window functions like ROW_NUMBER().
Currently, SQL Server users often rely on:
- ROW_NUMBER() OVER (ORDER BY (SELECT 1)) – which is not always stable due to execution plan optimizations and parallelism.
- Manually assigning row numbers in loops – which is inefficient for large datasets.
- SSMS automatically assigning row numbers in result sets – but this behavior is unavailable in T-SQL queries.
Proposed Solution:
Introduce a built-in, lightweight function like:
SELECT SEQ_NUMBER(), * FROM MyQuery;
Where SEQ_NUMBER() assigns a sequential number based on the final result set order, similar to how SSMS automatically numbers rows in its output.
Benefits:
✅ Works without needing an explicit ORDER BY.
✅ Eliminates reliance on ROW_NUMBER() OVER (ORDER BY (SELECT 1)), which can be unstable in parallel execution.
✅ Reduces unnecessary sorting overhead when users only need a sequence number.
✅ Aligns with SSMS behaviour, where query results are always displayed with row numbers.
This feature would greatly simplify reporting queries, temporary data processing, and procedural workflows where a sequence is needed without an ordering constraint.
Example Use Case:
SELECT SEQ_NUMBER(), CustomerName, OrderAmount
FROM Orders
WHERE OrderDate > '2024-01-01';
Expected Output:
SEQ_NUMBER() | CustomerName | OrderAmount
1 | John Doe | 500.00
2 | Jane Smith | 700.00
3 | Mike Ross | 300.00
Would love to hear thoughts from the SQL Server team and the community on this!
Jagdish M
- 主要言語
- PowerShell
- スター
- 11.2k
- フォーク
- 9.1k
- 平均マージ
- 16時間 27分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/sql-server-samples のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
microsoft/sql-server-samples#1499 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/sql-server-samples#1495 · リアクション 3 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
microsoft/sql-server-samples#1341 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 64/100
microsoft/sql-server-samples#276 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
microsoft/sql-server-samples#1497 ·
microsoft/sql-server-samples の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zcashlabs/thus-spoke-zakura#153 ·
メンテナーはふだん 1 日以内に返信
-
core
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
vectorize-io/hindsight#5276 ·
メンテナーはふだん 1 日以内に返信
-
duplicate request-theme
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
LizardByte/ThemerrDB#8856 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
perf(core): getComments() runs the approved count and the comment list as two sequential queriesオープンarea/core bot:bug bot:working
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
emdash-cms/emdash#3905 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Arkansas 2025 tax is $1.70 high above $100,000 net taxable income ($3,809 + 3.9% rule)対応中かも @PavelMakarchuk が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
PolicyEngine/policyengine-us#9828 ·
メンテナーはふだん 2 日以内に返信