CREATE PROC innerProc ( @pageIndex INT , @pageSize int ) AS BEGIN DECLARE @strQureySql NVARCHAR(1000) --查询语句 DECLARE @strStartdNum VARCHAR(100) -- DECLARE @strEndNum VARCHAR(100) SET @strStartdNum[email protected]*(@pageIndex-1)+1 SET @strEndNum[email protected]*@pageSize SET @strQureySql=‘ select * from ( select ROW_NUMBER() OVER (ORDER BY sm.ID desc) as number, sm.ID smid,sm.fatherid,sm.title,smf.id smfid,smf.SysMenu_ID FROM sysmenu sm LEFT JOIN SysModuleFunction smf ON sm.ID=smf.SysMenu_ID )t where number BETWEEN ‘[email protected] +‘ and ‘[email protected] +‘‘ EXEC(@strQureySql) PRINT(@strQureySql) END EXEC innerProc 2,10 DROP PROC innerProc
时间: 2024-10-28 20:05:15