How to add a serial number with a Query's Result Set?

In SQL Server 2005, We have ROW_NUMBER() function.

Here is the sample code:
It will display a serial number with a result set of a SQL's Select Query.

SELECT ROW_NUMBER()
OVER (ORDER BY SiteName) as ID,
SiteName,Latitude,Logitude, CityID
FROM
Sites

No comments: