difference between row_number and top in sql server

  • Hi,

    what is the difference between row_number and top functions in sql server

  • Easier question would be what are the similarities, because the answer to that would be "None"

    Row number assigns sequential numbers to a column in a resultset, based on what is specified for the partition and ordering. It's one of a class of windowing functions (the others being Rank, DenseRank and NTile)

    Top limits the maximum number of rows returned by a query.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi

    If you want know the T-sql difference , you can refer this link

    http://thehobt.blogspot.com/2009/02/rownumber-rank-and-denserank.html

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply