I am trying to implement something a function within SQL server 2000 which allows a user to identify the number of the record returned from a table (it is a bit like record paging). The stored procedure will be using the following syntax:

exec MySPName 'table_name', startRecord, numberofRowsReturn

For example, if startrecord = 1, numberofRowsReturn = 20, the first 20 records in a table will be returned...etc.

I have tried using a combination of 'top x' and 'not exists' but then it does not seem to work.. Anyone has better idea?

Thanks in advance.
Cheers,
Wai-man