Ranking functions are introduced in sql server 2005. Ranking functions are used to creating arrays, generating sequential numbers, finding ranks, and so on, which in pre-2005 versions require more lines of code, now can be implemented easier and faster.
Let's look at the syntax of ranking functions
ROW_NUMBER () OVER ([] )
RANK () OVER ([] )
DENSE_RANK () OVER ([] )
NTILE (integer_expression) OVER ([] )
Try the following code to get Row Number:-
SELECT ROW_NUMBER() OVER (ORDER BY FieldName ASC) AS ROWNO, * FROM Table_Name
Let's look at the syntax of ranking functions
ROW_NUMBER () OVER ([
RANK () OVER ([
DENSE_RANK () OVER ([
NTILE (integer_expression) OVER ([
Try the following code to get Row Number:-
SELECT ROW_NUMBER() OVER (ORDER BY FieldName ASC) AS ROWNO, * FROM Table_Name
No comments:
Post a Comment
Plz Share your comments...