Apply Row Number in a query

select *, row_number() over(order by intID )as RowNumber from TableName


You can also used Partition By in place of Order by to used partition


select *, row_number() over(partition by intID )as RowNumber from TableName

Comments

Popular posts from this blog

TSQL To Get All the Names of tables and Databases whose data have changed in last 24 Hours

To Get All the Names of tables and Databases their data have changed in last 24 Hours And Backup those databases

Apply paging in procedure