现在的位置: 首页 > 综合 > 正文

分页SQL脚本

2012年06月11日 ⁄ 综合 ⁄ 共 261字 ⁄ 字号 评论关闭
alter proc trunpage
@pageindex int
as
declare @table varchar(1000),@retTable varchar(4000)
set @table='select * from jobs '
set @retTable='select top 2 * from ('+@table+') a  where job_id not in (select top '
+cast((@pageindex-1)*2 as varchar(20))+' job_id from jobs )'
print @retTable
exec (@retTable)

抱歉!评论已关闭.