Thursday, 15 March 2018

ROW_NUMBER SQL Server


When SQL query has been run a query for create some output then sql server track number row on per partition returned. Which you can show using row number on the basis of following example


Syntax:

SELECT ROW_NUMBER() OVER (Order by Column_name) AS RowNumber,Col1,Col2,…
FROM dbo.newadmission

[condition]

Example :


SELECT ROW_NUMBER() OVER (Order by name) AS RowNumber,Name,city
FROM dbo.newadmission
where roll>100



No comments:

Post a Comment