Sql-Server 2005 introduced a bunch of new functions for ranking and windowing data. Try Using Ranking and Windowing Functions in SQL Server 2005[^]
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".