Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Creating a generic and re-usable stored procedure for pagination.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-11 : 07:54:55
Ryan writes "Hello,


I've been looking into creating a generic stored procedure that would allow me to perform pagination on a wide variety of data. I am hoping there may be some way to send these items to a stored procedure and retreive a page worth of records:


1. A parameterized query (to prevent having to escape any user input)
2. A list of parameters for the above query
3. The number of records required for each page
4. The desired page number


This stored procedure would be remarkably useful in any application with a search feature that needed paged results. It would handle both the security issue of searching on user input (with the parameterized query) and would eleminate the need for an individual stored procedure for each application's paging needs.


Thank you for your help,
Ryan"

darenkov
Yak Posting Veteran

90 Posts

Posted - 2005-02-12 : 22:51:31
Ryan,

there are a few cool examples of paging on this website.

check these out:

http://www.sqlteam.com/searchresults.asp?SearchTerms=paging
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-02-13 : 07:02:34
This may help
http://weblogs.sqlteam.com/jeffs/archive/2004/03/22/1085.aspx
Go to Top of Page
   

- Advertisement -