DCSIMG
Select TOP ROWNUM - Adlai Maschiach

Adlai Maschiach

" You have to show in order to be seen "

News

Favorite Links

news

CardSpace

Books

Other InfoCards Proj

Virtual Earth

WSS / Sharepoint

SOA , Biztalk & ESB

CLR / .NET

Select TOP ROWNUM

For some of you this may already be common knowledge/everyday experience, but today was my first time I have actually used in SQL2005 the "rownum" ( SqlServer Function row_number() ) feature, here's a small example:

select * from
(
   select *, row_number() over(order by CustomerId) as rownum from customers
) as c
where c.rownum between 1000 and 10000;

this VERY NICE feature along together with the PagedDataSource class enables you paging in .NET 2.0.
We know that the TOP had problems in the SQL2000 and this solves it.

Comments

krudo.net said:

hi adlai,

great post!

I find this nice example:

http://www.codeproject.com/useritems/GridViewNeatPaging.asp?msg=2068271

thank's

krudo

# June 10, 2007 10:10 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: