?
/ *? 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: //www.wellknow.net? Update: 20040610? Support: http://bbs.wellknow.net? Copyright: Please indicate the source: Create thinking Future WellkNow.net * /
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
Posted on 2004