You can get the last # by the following query...
WITH CTE (Name, Position) AS (
SELECT NAME,
ROW_NUMBER() OVER (ORDER BY NAMEID)
FROM EMPLOYEE
)
SELECT MAX(Position) FROM CTE
If NameID is an integer and an auto-increment field then you can simply use the SELECT MAX(NameID) FORM EMPLOYEE to get the last row....
Please let me know if this isn't resolve your problem
Thanks