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

首頁 > 開發(fā) > 綜合 > 正文

BigEagle的數(shù)據(jù)庫結(jié)構(gòu)(轉(zhuǎn)載,一動(dòng)手,就輕拿5分)

2024-07-21 02:16:40
字體:
供稿:網(wǎng)友
*bbs表*/
if exists(select * from sysobjects where id = object_id('bbs'))
drop table bbs
go

create table bbs
(
id int identity primary key ,
rootid int default 0 not null , --根id
fatherid int default 0 not null , --父id
layer tinyint default 0 not null , --層
ordernum float(53) default 0 not null , --排序基數(shù)
userid int default 0 not null , --發(fā)言人id
forumid tinyint default 1 not null , --版面id
subject varchar(255) default '' not null , --主題
content text default '' not null , --內(nèi)容
faceid tinyint default 1 not null , --表情
hits int default 0 not null , --點(diǎn)擊數(shù)
ip varchar(20) default '' not null , --發(fā)貼ip
time datetime default getdate() not null , --發(fā)表時(shí)間
posted bit default 0 not null --是否精華貼子
)
go


/*forum版面表*/
if exists(select * from sysobjects where id = object_id('forum'))
drop table forum
go

create table forum
(
id tinyint identity primary key ,
rootid tinyint default 0 not null , --根id
fatherid tinyint default 0 not null , --父id
layer tinyint default 0 not null , --層
title varchar(50) default '' not null , --版面名稱
description varchar(255) default '' not null , --版面描述
masterid int default 1 not null , --版主id
topiccount int default 0 not null , --貼子總數(shù)
time datetime default getdate() not null , --創(chuàng)建時(shí)間
isopen bit default 0 not null --是否開放
)
go

/*************************************************************************/
/* */
/* procedure : up_gettopiclist */
/* */
/* description: 貼子列表 */
/* */
/* parameters: @a_intforumid : 版面id */
/* @a_intpageno: 頁號(hào) */
/* @a_intpagesize: 每頁顯示數(shù),以根貼為準(zhǔn) */
/* */
/* use table: bbs , forum */
/* */
/* author: [email protected] */
/* */
/* date: 2000/2/14 */
/* */
/* history: */
/* */
/*************************************************************************/
if exists(select * from sysobjects where id = object_id('up_gettopiclist'))
drop proc up_gettopiclist
go

create proc up_gettopiclist
@a_intforumid int ,
@a_intpageno int ,
@a_intpagesize int
as
/*定義局部變量*/
declare @intbeginid int
declare @intendid int
declare @introotrecordcount int
declare @intpagecount int
declare @introwcount int
/*關(guān)閉計(jì)數(shù)*/
set nocount on

/*檢測(cè)是否有這個(gè)版面*/
if not exists(select * from forum where id = @a_intforumid)
return (-1)

/*求總共根貼數(shù)*/
select @introotrecordcount = count(*) from bbs where fatherid=0 and [email protected]_intforumid
if (@introotrecordcount = 0) --如果沒有貼子,則返回零
return 0

/*判斷頁數(shù)是否正確*/
if (@a_intpageno - 1) * @a_intpagesize > @introotrecordcount
return (-1)

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

/*結(jié)束rootid*/
set @introwcount = @a_intpageno * @a_intpagesize
/*限制條數(shù)*/
set rowcount @introwcount
select @intendid = rootid from bbs where fatherid=0 and [email protected]_intforumid
order by id desc

/*恢復(fù)系統(tǒng)變量*/
set rowcount 0
set nocount off

select a.id , a.layer , a.forumid , a.subject , a.faceid , a.hits , a.time , a.userid , a.fatherid , a.rootid ,
'bytes' = datalength(a.content) , b.username , b.email , b.homepage , b.signature , b.point
from bbs as a join bbsuser as b on a.userid = b.id
where [email protected]_intforumid and a.rootid between @intendid and @intbeginid
order by a.rootid desc , a.ordernum desc
return(@@rowcount)
--select @@rowcount
go

中國(guó)最大的web開發(fā)資源網(wǎng)站及技術(shù)社區(qū),
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 蒙城县| 洛隆县| 黑龙江省| 本溪市| 瑞昌市| 封开县| 临沂市| 军事| 东明县| 临夏市| 乌拉特中旗| 罗山县| 吐鲁番市| 湘阴县| 子洲县| 祁东县| 翁源县| 安乡县| 武川县| 北海市| 民权县| 赤峰市| 广宁县| 庆阳市| 化州市| 盐边县| 双柏县| 汶川县| 四子王旗| 益阳市| 彰武县| 绩溪县| 丰台区| 穆棱市| 仙游县| 墨脱县| 昔阳县| 原平市| 全椒县| 原平市| 平果县|