Question: how to find last row_number
in a table in SQL Server? For example, I have a table named Employee
without any ID and don't wanna add any identity column.
EmpName | EmpSalary
--------+----------
Amit | 5000
Sumit | 4500
Ajeet | 5600
I tried this:
SELECT
ROW_NUMBER() OVER(ORDER BY EmpName) row_no
FROM
Employee
but it returns this:
row_no
1
2
3
but, if 3 is the last row_no, then I want:
row_no
3
now, please help me to solve this.