[Millions] Universal stored procedures. Paging stored procedures.

zhaozj2021-02-16  81

/ *? Name: spall_returnrows? Enter:? Output:? Call: ?? EXEC spall_returnrows 'SELECT? * From table 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? Mail: DiliatwellkNow.net? HTTP: //12986.com? Update: 20040610? Support: http://cs.12986.com? Copyright: Please indicate the source * /

Create Procedure DBO.SPALL_RETURNROWS (? @ SQL NVARCHAR (4000),? @ Page Int,? @ @ Id 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 *) AS varchar (20)) '' @ ID 'from (' @ SQL ') T9 Order By' @ Sort ') Order By' @ Sort

Print @str

EXEC SP_EXECUTESQL @STRGO

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

New Post(0)