SQL Server in a minute: Creating a numbered list #sqlserver #shorts

preview_player
Показать описание
Here are 3 ways to create a numbered list in SQL Server.
My SQL Server Udemy courses are:
----
Here is the code - please replace LESSTHAN with the less than sign:
SELECT *

-- Example 1

SELECT ROW_NUMBER() OVER(ORDER BY object_id)
AS RowNumber

-- Example 2

WITH myTable AS
(SELECT ROW_NUMBER() OVER(ORDER BY object_id)
AS RowNumber

SELECT *
FROM myTable
WHERE RowNumber LESSTHAN 101;

-- Example 3

WITH myTable AS
(SELECT ROW_NUMBER() OVER(ORDER BY O.object_id)
AS RowNumber

SELECT *
FROM myTable;

----
Links to my website are:
Рекомендации по теме