Create Procedure DBO.PAGER (- Number of current pages @PAGENUM INT, - get the number of records per page @Rowcount Int, - Return to the total number of records @count int output) AS
- Define start record IDDeclare @start int - Define End Record IDDeclare @end Int - Set the start record ID, associated with the number of current pages, and per page. Set @ start = @ Pagenum * @ rowcount - Set the end record ID, associated with the number of current pages and per page record number, the start record ID minus the number of records per page is the number of records of the current page. Set @ End = @ Start- @ rowcount - Settings Number Set RowCount @ start - Insert the selected record into the temporary table Select * INTO # T1 from myTable - Set the deleted record number set rowcount @ END - not the first Remove the table when you delete the table, the data is not deleted when the table is deleted. IF @end> 0 - Delete unnecessary data in a temporary table DELETE # T
- Do not limit the selected records set rowcount 0 - Display data in the temporary table Select * from # T1
--Declare @count int selection @ count = count (*) from myTableGo