Thursday, August 13, 2015

how-can-i-remove-duplicate-rows

;WITH cte
     AS (SELECT ROW_NUMBER() OVER (PARTITION BY Col1, Col2, Col3 
                                       ORDER BY ( SELECT 0)) RN
         FROM   #MyTable)
DELETE FROM cte
WHERE  RN > 1

nth max salary in sql

WITH CTE AS
(
    SELECT EmpID,EmpName,EmpSalar,
           RN = ROW_NUMBER() OVER (ORDER BY EmpSalary DESC)
    FROM dbo.Salary
)
SELECT EmpID,EmpName,EmpSalar
FROM CTE
WHERE RN = @NthRow

Monday, August 10, 2015

interface with same method name in c#










interface IPrinter
    {
        void print(string a);
    }

    interface IPrinter1
    {
        void print(string a);
    }




class Program
    {
        static void Main(string[] args)
        {
            IPrinter p = new Printer();
            p.print("rahul");

            Printer p1 = new Printer();
            ((IPrinter)p1).print("overlaoded");
        }
      
    }

    class Printer : IPrinter, IPrinter1
    {
         void IPrinter.print(string a)
        {
            Console.Write(a + "Printer");
            Console.ReadLine();
        }

         void IPrinter1.print(string a)
        {
            Console.Write(a+"Printer1");
            Console.ReadLine();
        }
    }