Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Provide a Built-in Function for Sequential Row Numbers in Query Output

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
sql
領域
databases

調査の方向性

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:

  1. ROW_NUMBER() OVER (ORDER BY (SELECT 1)) – which is not always stable due to execution plan optimizations and parallelism.
  2. Manually assigning row numbers in loops – which is inefficient for large datasets.
  3. 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

microsoft/sql-server-samples のほかの issue

microsoft/sql-server-samples の issue をすべて見る

似ている issue

Databases の issue をもっと見る

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

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