Explain ROW_NUMBER() with an example

 Posted by CGN007 on 7/20/2012 | Category: Sql Server Interview questions | Views: 1802 | Points: 40

ROW_NUMBER() returns the sequential number of a row starting at 1 for the first row.

Simple Example

SELECT ROW_NUMBER() OVER(ORDER BY emp_id DESC) AS Row,emp_id,emp_salary FROM employee

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response