SQL 2000 - T-SQL

"James Brophy (CharcolOnline)" <[email protected]> Mon, 3 Feb 2003 15:59:59 -0000
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <0C2B60E78DA5D311B20800508B61B6C001F33354@JC_LINT>
Can anyone shed any light on this?

I need a resultset returned from SQL Server from a Customer table. The
table has an Identity column as a Primary Key - Eg. CustomerID

The resultset will reflect various searches. Eg. By Surname, By
Surname & PostCode

I'm being passed 2 extra variables: PageNumber and RowsPerPage

Thus, if the initial resultset of a search on 'Smith%' brought back
100 rows and PageNumber was 5 and RowsPerPage was 10, then I would
return rows 51 to 60.

The Order By clause would be on Surname, Forename.

Can this be written in SQL without resorting to either Cursors or
Temporary Tables?

Thanks for your help.

You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.