sqlserver中带分页查询的存储过程返回怎么是三张表,第三个表才是正确的。怎么让它只返回第三张表 ql语句如下:
create PROC cursor_page
@SqlStr NVARCHAR(4000), --查询字符串
@CurrentPage INT, --第N页
@PageSize INT --每页行数
AS
BEGIN
SET NOCOUNT ON
DECLARE @P1 INT, --P1是游标的id
@rowcount int
EXEC sp_cursoropen @P1 OUTPUT,@sqlstr,@scrollopt=1,@ccopt=1,@rowcount=@rowcount output
select @rowcount as 'rowCount'
--SELECT CEILING(1.0*@rowcount/@pagesize) AS 总页数--,@rowcount as 总行数,@currentpage as 当前页
SET @currentpage=(@currentpage-1)*@pagesize+1
EXEC sp_cursorfetch @P1,16,@currentpage,@pagesize
EXEC sp_cursorclose @P1
SET NOCOUNT OFF
END