SQL Server in a minute: Creating a numbered list

Published: 26 October 2023
on channel: SQL Server 101
1,044
59

Here are 3 ways to create a numbered list in SQL Server.
My SQL Server Udemy courses are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: https://rebrand.ly/querying-microsoft...
98-364: Database Fundamentals (Microsoft SQL Server): https://rebrand.ly/database-fundamentals
70-462 SQL Server Database Administration (DBA): https://rebrand.ly/sql-server-dba
Microsoft SQL Server Reporting Services (SSRS): https://rebrand.ly/sql-server-ssrs
SQL Server Integration Services (SSIS): https://rebrand.ly/sql-server-ssis
SQL Server Analysis Services (SSAS): https://rebrand.ly/sql-server-ssas-mdx
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): https://rebrand.ly/microsoft-powerpiv...
----
Here is the code - please replace LESSTHAN with the less than sign:
SELECT *
FROM sys.objects

-- Example 1

SELECT ROW_NUMBER() OVER(ORDER BY object_id)
AS RowNumber
FROM sys.objects;

-- Example 2

WITH myTable AS
(SELECT ROW_NUMBER() OVER(ORDER BY object_id)
AS RowNumber
FROM sys.objects)

SELECT *
FROM myTable
WHERE RowNumber LESSTHAN 101;

-- Example 3

WITH myTable AS
(SELECT ROW_NUMBER() OVER(ORDER BY O.object_id)
AS RowNumber
FROM sys.objects AS O
CROSS JOIN sys.objects AS O2
CROSS JOIN sys.objects AS O3)

SELECT *
FROM myTable;

----
Links to my website are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: http://idodata.com/querying-microsoft...
98-364: Database Fundamentals (Microsoft SQL Server): http://idodata.com/database-fundament...
SQL Server Essential in an Hour: http://idodata.com/sql-server-essenti...
70-462 SQL Server Database Administration (DBA): http://idodata.com/sql-server-databas...
DP-300: Administering Relational Databases: http://idodata.com/dp-300-administeri...
Microsoft SQL Server Reporting Services (SSRS): http://idodata.com/microsoft-sql-serv...
SQL Server Integration Services (SSIS): http://idodata.com/sql-server-integra...
SQL Server Analysis Services (SSAS): http://idodata.com/sql-server-ssas-mu...
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): https://rebrand.ly/microsoft-powerpiv...
1Z0-071 Oracle SQL Developer – certified associate: http://idodata.com/iz0-071-oracle-sql...
SQL for Microsoft Access: http://idodata.com/sql-for-microsoft-...
DP-900: Microsoft Azure Data Fundamentals: http://idodata.com/dp-900-microsoft-a...


Watch video SQL Server in a minute: Creating a numbered list online without registration, duration hours minute second in high quality. This video was added by user SQL Server 101 26 October 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,044 once and liked it 59 people.