How to Find nth Record in a table?



How to top nth element in a column of a table?          
There may be ways to slove this problem, and it found easy in this soluntion.  CREATE PROC spforNelement
(
      @Nelement INT
)
AS
BEGIN TRY
;
WITH tbltemp_agan AS
(
      SELECT *,
            RANK() OVER( ORDER BY Salary DESC) AS RANKID
      FROM Employee
)
SELECT * FROM tbltemp_agan WHERE RankID=@Nelement
END TRY
BEGIN CATCH
        RAISERROR ('An error occured in the NonFatal table',10,1)
END CATCH

This procedure is to find nth element in a column of table.

Here we use temp table for saving the rank of each row for a required column by using RANK()function. Then save the output of the phsycal table along with a extra column as RANKID into a temp table.      Now accept a input parameter from procedure and compare it with in the column RANKID in the where clause as shown above. This is one way of finding top nth element in a column of a table.. 

Happy coding.