Adding serial number for rows in SQL Server

Adding serial number based on number of rows displaying.

You need to add following to your query or Column Name

Syntax :


Row_Number() Over (Order By a.emp_mast_id) As emp_mast_id

Example  :


select Row_Number() Over (Order By a.emp_mast_id) As emp_mast_id,
a.emp_name,
a.address
from Emp_mast a


ID   Name   Address
1     Nihar    India
2     sam       UK
3     John      USA


Comments

Popular posts from this blog

Add Serial no in crystal report without coding

Working with Oracle's BLOB and Microsoft's C#

File operations in C# (.net)