How to display Row Numbers in the results in SQL Query ?

If you want to return the row number as a part of your results in the SQL Query , you can use the ROW_NUMBER function and specify the ORDER BY clause to it as shown in this blog post.

How to display Row Numbers in the results in SQL Query ?

use AdventureWorks2014 
GO 
SELECT ( ROW_NUMBER() OVER (ORDER BY BusinessEntityID)) AS RowNumber, 
LoginID 
FROM HumanResources.Employee