Ajax paging (content related to stored procedures)

Source: Internet
Author: User

<1>

First we declare the definition stored procedure in the database (SQL Server)

Use Salesif (Exists (SELECT * from sys.objects where name= ' proc_location_paging ')) drop proc Proc_location_paginggocreate Proc proc_location_paging--Create stored procedure (@pageSize int,--page size @currentpage int,--current page @rowcount int output,--Total number of rows (outgoing parameters) @pageC ount int output--Total number of pages (outgoing parameter)) Asbeginselect @rowCount = COUNT (locid) from location--assigns @rowcount to select @pageCount = CEILING ((Count (locid) +0.0)/@pageSize) from location-assigns @ @pageCount select TOP (@pagesize) * FROM (select Row_number () over ( Order by Locid) as rowid,* from location) as T1where RowID > (@pageSize * (@currentpage-1)) Endgo---------------------------------above means that the stored procedure is already defined. ---------------------------------The following is the execution of this stored procedure. We can see the result declare @rowCount int, @pageCount INT--Declare two parameters first-execute proc_location_paging this stored procedure. @rowCount, @pageCount have output at the back to indicate that both of them are out-of-parameters exec proc_location_paging 10,1, @rowCount output, @pageCount output SELECT @ RowCount, @pageCount--Query the values of these two parameters



Ajax Paging (content related to stored procedures)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.