Developping for the translation industry RSS 2.0



 Thursday, 10 July 2008

Using SQL Server 2005 new function ROW_NUMBER() makes this really easy.

All you have to do is to add the function ROW_NUMBER, with the OVER() clause as such :

SELECT ROW_NUMBER() 
        OVER (ORDER BY EmployeeName) AS Row, 
    EmployeeId, EmployeeName, Salary 
FROM Employees
The OVER clause needs an “order by” parameter to know how to sort the rows for proper numbering.
 
Thursday, 10 July 2008 15:58:08 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Code Snippet | SQL

Navigation
Advertisement
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Stanislas Biron
Sign In
Statistics
Total Posts: 135
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2017, Stanislas Biron