Returns the rank of each row within the partition of a result set. The rank of a row is one plus the number of ranks that come before the row in question. ().
Sample Source Pattern
Syntax
IN -> SqlServer_01.sql
RANK ( ) OVER ( [ partition_by_clause ] order_by_clause )
OUT -> SqlServer_01.sql
RANK( )
-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '1' COLUMN '9' OF THE SOURCE CODE STARTING AT 'OVER'. EXPECTED 'BATCH' GRAMMAR. CODE '80'. **
-- OVER ( [ partition_by_clause ] order_by_clause )
Examples
Code:
IN -> SqlServer_02.sql
SELECT TOP 10 BUSINESSENTITYID, NATIONALIDNUMBER, RANK() OVER (ORDER BY NATIONALIDNUMBER) AS RANK FROM HUMANRESOURCES.EMPLOYEE AS TOTAL