A new function in sql server 2005. It's function returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.
Syntax :
ROW_NUMBER ( ) OVER ( [] )
Example :
create table Testing ( Kd varchar(10) not null, Name varchar(10) )
insert into Testing values('K01','Siji')
insert into Testing values('K02','Loro')
insert into Testing values('K03','Telu')
insert into Testing values('K04','Opat')
select ROW_NUMBER() OVER(ORDER BY Kd) AS 'No.' , Kd , Name from Testing
Output :
Easy Right!!!
Happy Code \^_^/