Possible Duplicate:
ROW_NUMBER() without over in SQL
I have a grid with sorting on each column and have to show only 50 rows at a time.
I am using sql server 2005 as database.
Now there is ROW_NUMBER function in sql server 2005 to filter the data with row number but Over(order by [Column]) is mandatory to use. In my case I have to sort my grid with different columns so I can not use the static columns name in order by clause. The restriction is , I have to use static query.
Can you guys help me out on this problem?
Use several ROW_NUMBER clauses per column and choose the relevant one:
OR use a CASE expression. Note: all datatypes must be compatible
OR If you really want an arbitrary row number then do this: