国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

存儲過程的分頁!!

2024-07-21 02:22:36
字體:
來源:轉載
供稿:網友
create proc up_gettopiclist
       @a_strforumid varchar(50) ,
       @a_intpageno int  ,
       @a_intpagesize int
as
   /*定義局部變量*/
   declare @intbeginid         int
   declare @intendid           int
   declare @introotrecordcount int
   declare @intpagecount       int
   declare @introwcount        int
   /*關閉計數*/
   set nocount on
   
  
   /*求總共根貼數*/
   select @introotrecordcount = count(*) from bbs_topic where fatherid=0 and [email protected]_strforumid
   if (@introotrecordcount = 0)    --如果沒有貼子,則返回零
       return 0
       
   /*判斷頁數是否正確*/
   if (@a_intpageno - 1) * @a_intpagesize > @introotrecordcount
      return (-1)

   /*求開始rootid*/
   set @introwcount = (@a_intpageno - 1) * @a_intpagesize + 1
   /*限制條數*/
   set rowcount @introwcount
   select @intbeginid = rootid from bbs_topic where fatherid=0 and [email protected]_strforumid
          order by tid desc

   /*結束rootid*/
   set @introwcount = @a_intpageno * @a_intpagesize
   /*限制條數*/
   set rowcount @introwcount
   select @intendid = rootid from bbs_topic where fatherid=0 and [email protected]_strforumid
          order by tid desc

   /*恢復系統變量*/
   set rowcount 0
   set nocount off   

   select a.tid , a.layer , a.forumid , a.subject , a.faceid , a.hits , a.posttime , a.userid , a.fatherid , a.rootid ,
         'bytes' = datalength(a.content) , b.loginname  , b.email  , b.homepage , b.signature , b.point
     from bbs_topic as a join bbs_user as b on a.userid = b.uid
     where [email protected]_strforumid and a.rootid between @intendid and @intbeginid
         order by a.rootid desc , a.ordernum desc
   return(@@rowcount)
   --select @@rowcount
go    

怎么操作就不貼了!!大家好好看看,,歡迎訪問網頁設計愛好者web開發。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 尉犁县| 孝感市| 洞口县| 榆林市| 南通市| 如东县| 安庆市| 海南省| 阳泉市| 盱眙县| 公安县| 郧西县| 河池市| 南雄市| 叙永县| 冷水江市| 定结县| 湾仔区| 南城县| 巴中市| 五指山市| 罗甸县| 杭锦后旗| 两当县| 曲阳县| 荣昌县| 印江| 东丰县| 翁牛特旗| 保靖县| 乐清市| 福鼎市| 阜平县| 修文县| 双牌县| 迁安市| 永年县| 北宁市| 大洼县| 阿勒泰市| 榆树市|