This article will explain how we can add sequence row number to a SQL select query starting from 1 onwards. This can be achieved by using built in SQL function ROW_NUMBER(). This function simply generates row number for each row in the result. You can specify the partition and order by criteria. This is how it works..
..
Use of ROW_NUMBER() will assign sequence number to rows as:
read full article
..
Use of ROW_NUMBER() will assign sequence number to rows as:
SELECT ROW_NUMBER()
OVER (ORDER BY EmployeeName) AS Row,
EmployeeId, EmployeeName, Salary
FROM Employees
Row EmployeeId EmployeeName Salary
-------------------------------------------
1 1002 Alden 4000
2 2343 Lawson 4500
3 2004 Barbra 4800
4 1105 Marsden 4500
5 3116 Mac 5000
read full article
for daily .net code, c# code visit DailyCoding