Friday, March 22, 2013

Add RowNumber Column in Table


Hello I have a Table with column PageId and PageName.Now i want add one more column Rownumber while selecting data.

So we can use the following querry.

 WITH tempTable as
  (
    select ROW_NUMBER() Over(order by PageId) As RowNumber,* from tblPageInfo
  )
  select * from tempTable


This will list three column RowNumber,PageId,PageName

0 comments:

Post a Comment