[Millions] Universal stored procedures. Page stored procedures (picked)

xiaoxiao2021-03-06  96

/ * Name: Spall_returnrows Enter: Output: Call: EXEC Spall_ReturnRows 'Select * from the Name, page number, return record number,' primary key ',' Sort Field 'Spall_ReturnRows' Select * from all_categories ', 2, 10,' [ ID] ',' [ID] 'Description: [one million] common storage procedure stored procedure .. returns the specified number of pieces returned, specify the number of pages of records: Dili JF Senders e-mail: diliatwellknow.net website: http: //www.wellknow.net Update: 20040610 Support: http://bbs.wellknow.net copyright: Please indicate the source when you use thinking, WellkNow.net * /

Create Procedure DBo.spall_ReturnRows (@SQL NVARCHAR (4000), @Page Int, @RecsperPage Int, @ 2 Varchar (255), @Sort Varchar (255)) AS

Declare @str nvarchar (4000)

Set @ Str = 'SELECT TOP' CAST (@Recsperpage As Varchar (20)) '* from (' @ SQL ') T where t.' @id 'Not in (SELECT TOP' CAST ((@ Recsperpage * (@ Page-1)) AS VARCHAR (20)) '' @ ID 'from (' @ SQL ') T9 Order By' @ Sort ') Order by' @ Sort

/ * Print @ str * /

EXEC SP_EXECUTESQL @STRGO

转载请注明原文地址:https://www.9cbs.com/read-122795.html

New Post(0)