Home > Database > Mysql Tutorial > body text

MSSQL根据ID进行分页实现方法

WBOY
Release: 2016-06-07 16:17:52
Original
1199 people have browsed it

代码如下: ALTER PROCEDURE [a0919194122].[dnt_getappinvitelist] @uid int, @pageindex int, @pagesize int AS DECLARE @startRow int, @endRow int SET @startRow = (@pageIndex - 1) * @pagesize IF @pageindex = 1 BEGIN EXEC( 'SELECT TOP '+@pagesize

代码如下:

ALTER PROCEDURE [a0919194122].[dnt_getappinvitelist]
@uid int,
@pageindex int,
@pagesize int
AS
DECLARE @startRow int,
@endRow int
SET @startRow = (@pageIndex - 1) * @pagesize
IF @pageindex = 1
BEGIN
EXEC(
'SELECT TOP '+@pagesize+' [id],[typename],[appid],[type],[fromuid],[touid],[myml],[datetime],[hash] FROM [dnt_myinvite] WHERE [touid]='+@uid+' ORDER BY [id] DESC'
)
END
ELSE
BEGIN
EXEC('
SELECT
TOP '+@pagesize+'
[id],[typename],[appid],[type],[fromuid],[touid],[myml],[datetime],[hash]
FROM [dnt_myinvite]
WHERE [touid]='+@uid+'
AND [id] FROM [dnt_myinvite]
WHERE [touid]='+@uid+'
ORDER BY [id] DESC
) AS T
)
ORDER BY [id] DESC
')
END

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!