SQLServer 分页查询

一. sqlServer2008 分页查询

select * from (
select  t.*,r.strclipid,r.nsoftcheck  ,ROW_NUMBER() OVER(ORDER BY nSectionIndex ASC,nBidindex ASC,nLidindex ASC )  as R from  
(SELECT t_ProgramSheet.strPSID,t_ProgramSheet.strSectionGuid,t_ProgramSheet.strChnID,t_ProgramSheet.tPlayDate, 
t_ProgramSheet.strUserID,t_ProgramSheet.nState,t_ProgramSheet.nPGmlockState,t_ProgramSheet.nSubmitState, 
t_ProgramSheet.strRemark AS strPlayListRemark,t_ProgramSheet.tLastModifyTime,t_ProgramSheet.strPlayListVersion, 
t_ProgramSheet.nVersion,t_ProgramSheet.tCreateTime,t_ProgramSheet.strLastModifyUser,t_ProgramSheet.strLastAuditUser, 
t_ProgramSheet.tLastAuditTime,t_PlaylistCompile.strpgmGuid,t_PlaylistCompile.strPackGuid, 
t_PlaylistCompile.nIndex AS nBidindex,t_PlaylistCompile.strpgmName,t_PlaylistCompile.tpgmSchPlayDate,
 t_PlaylistCompile.npgmSchStartTime,t_PlaylistCompile.strpgmDuration,t_PlaylistCompile.npgmPlayStyle,
  t_PlaylistCompile.strRedundantDeviceTypeID,t_PlaylistCompile.strDeviceTypeID,t_PlaylistCompile.npgmPlayTitle,
   t_PlaylistCompile.npgmPlaylogo,t_PlaylistCompile.npgmPlayTransType,t_PlaylistCompile.npgmPlayTransRate, 
   t_PlaylistCompile.strExtPar AS strBidExtPar,t_PlaylistCompile.nReplay,t_PlaylistCompile.strColumnID,t_PlaylistCompile.nDelete, 
   t_PlaylistCompile.strVideoSrcDevID,t_PlaylistCompile.npgmDuration, t_PlaylistCompile.strRemark AS strBidRemark,
    t_PlaylistCompile.nPGmlock,t_BIDMapCompile.nIndex AS nLidindex,
    t_BIDMapCompile.strPrimaryID,t_BIDMapCompile.strRedundantID,t_BIDMapCompile.nTapeType,t_BIDMapCompile.nClipType,
 t_BIDMapCompile.strSOM,t_BIDMapCompile.strEOM,t_BIDMapCompile.strDuration,t_BIDMapCompile.strClipName,
 t_BIDMapCompile.strExtPar AS strLidExtPar, 
 t_BIDMapCompile.strdubSOM,t_BIDMapCompile.strdubEOM,t_BIDMapCompile.nSOM,
  t_BIDMapCompile.nDuration,t_BIDMapCompile.strTapeID,t_BIDMapCompile.nTapeSOM,t_BIDMapCompile.nSubBidID,
   t_BIDMapCompile.strSubBidName,t_SectionProperty.nSectionIndex,t_SectionProperty.strSectionName, 
   t_SectionProperty.nBeginTime,t_SectionProperty.strTempGuid,t_SectionProperty.nEndTime  
   FROM t_SectionProperty INNER JOIN t_ProgramSheet ON t_SectionProperty.strSectionGuid = t_ProgramSheet.strSectionGuid LEFT OUTER JOIN  
   t_BIDMapCompile RIGHT OUTER JOIN t_PlaylistCompile ON t_BIDMapCompile.strpgmGuid = t_PlaylistCompile.strpgmGuid ON
   t_ProgramSheet.strPSID = t_PlaylistCompile.strPSID  
   WHERE t_ProgramSheet.strSectionGuid IN ('7E9058EA-DE6E-43b9-B885-EF73786DCA06') AND t_ProgramSheet.strChnID = 'CHN09' AND tPlayDate = '2016-07-13' )  
   t  LEFT OUTER JOIN  ( select * from  T_BVSID WHERE    nDelete = 0 AND  nReady = 1 AND nCheck = 1 )   r on t.strprimaryid=r.strcliplogicid  
   ) Q  where R>100 AND R<=200

其中100,200分别为数据开始和结束行


二.sqlServer 2012分页查询

SELECT strClipName from t_BVSID ORDER BY strClipName  OFFSET 100 ROW  FETCH NEXT 50 ROW ONLY

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 &#39;EastRiver&#39; 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...