Hello everyone, today I am going to discuss the Row_number feature in SQL server.

what is Row_Number()?

Row_Number is used to generate the number of each row dynamically in a sequential order based on some column orders.

Row_Number() must be used with order by clause, without order by we can not use the Row_Nuber function.

Row_Number() over(order by EmpName) as RowNumber


Generate unique Id for each row dynamically: – In case if the table does not have a primary key or any unique identification number. you can use Row_Number to provide the unique ID for a table.

Row_Number() over(Order by EmailId) as Id,

An output from the above SQL Query







You can also watch video 


About The Author

Deependra Kushwah
Deependra kushwah is a member of the fastest growing bloggers community "betechnical", Author, Youtuber, and hardcore Coder. I love writing code in different languages, I also write blogs on tech tutorials, gadgets review and also post some technical videos on youtube on many topics.

This site uses Akismet to reduce spam. Learn how your comment data is processed.