本文实例讲述了MSsql分页存储过程。分享给大家供大家参考,具体如下:
2000
BEGIN
SET @TotalCount = 2000
END
IF @TotalCount%@PageSize = 0
BEGIN
SET @TotalPage = @TotalCount / @PageSize
END
ELSE
BEGIN
SET @TotalPage = @TotalCount / @PageSize + 1
END
SET NOCOUNT ON
EXEC (@strsql)
END
SET NOCOUNT OFF
/**调用实例:
EXEC Com_Pagination 100,--是否使用分组,否是
' a.pid=2'--查询条件
SELECT a.*
FROM Person p
LEFT JOIN TE a
ON a.PID = p.Id
WHERE a.pid = 2
**/