Difference between document.onclick() and click() function

There is no onclick event in jquery but there is .on eventinterviewer asks sometime

.click(handler):  Bind an event handler to the “click” JavaScript event, or trigger that event on an element.

.on( events [, selector ] [, data ], handler ) : Attach an event handler function for one or more events to the selected element. they can process events from descendant elements that are added to the document at a later time.

So if you are adding an element on page dynamically and want to fire an event use .on .

How to find third or nth highest salary in SQL Server?

This is one of common interview question,well  we can find our answer using below Methods…

Method 1 :  Using cte as below supoose we need 3rd highest salary

WITH CTE AS
(
SELECT Salary,
RNo = DENSE_RANK() OVER (ORDER BY Salary DESC)
FROM dbo.Employee
)
SELECT Salary
FROM CTE WHERE RNo = 3

Method 2 : Using SubQuery  finfing nth salary here (n-1 will be 2)

SELECT distinct Salary FROM Empoyee e1 where 
(n-1) = (SELECT count(distinct salary) from Employee e2 
WHERE e1.salary <= e2.salary);

Method 3 : 

 SELECT TOP 1 Salary FROM 
 (SELECT DISTINCT TOP 3 Salary FROM Employee ORDER BY Salary DESC )
 AS temp ORDER BY Salary

Find nth highest salary in SQL Server

In most of the interviews this question is asked,we have many ways to find the nth highest salary.

Suppose we have below data. And finding 3rd highest salary

Salary                                                           90000                                                     80000                                                     60000                                                     60000

Method 1 :

Select Top 1 salary from
(
Select distinct top 3 salary from employee
order by salary desc
) Result
order by salary

Output : 60000

Method 2 : 

With result as
(
Select salary,dense_rank() over (order by salary desc) drank from employee
)
Select salary from result
Where result.drank=3
Output : 6000

Method 3 : 

SELECT *
FROM Employee Emp1
WHERE (N-1) = (
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM Employee Emp2
WHERE Emp2.Salary > Emp1.Salary
)

How to debug/print Line no on live on IIS in Published code in .Net

When you publish your code in release mode on Server and you want to print a line number.You have to follow following steps to achieve this

Step-1 Right click You Project > Property > Package/Publish Web> Uncheck Exclude generated Debug Symbol

Step-2
Save and publish you code You will see PDB file will be generated over there which will track you published code Error.