Tuesday, September 11, 2012

How to fetch the nth highest salary from a table without using TOP and sub-query?

WITH Salaries AS
(
    SELECT Basic_Salary, ROW_NUMBER() OVER(ORDER BY Basic_Salary DESC) AS 'RowNum'
    FROM dbo.EMPLOYEE
)
SELECT
  Basic_Salary
FROM
  Salaries
WHERE
   RowNum <= 5

Implementing Service Locator (To Resolve Dependency)

using System; /// <summary> /// Summary description for Class1 /// </summary> public class serviceLocator {     public s...