某个课程设计时用到的SQL脚本,贴在这里供自己以后参考一下

晕哦,代码里没sql脚本
create database InterXDT on primary (name=InterXDT_data, filename='E:/onlinsale_data.mdf',/*数据库存放位置*/ size=2MB, maxsize=10, filegrowth=1) log on (name=InterXDT_log, filename='F:/onlinsale_log.ldf' ,/*日志文件存放位置*/ size=2MB, maxsize=8, filegrowth=1) go /*==============================================================*/ use InterXDT /*==============================================================*/ /* DBMS name: Microsoft SQL Server 2000 */ /* Created on: 2009-9-4 20:53:02 */ /*==============================================================*/ if exists (select 1 from sysobjects where id = object_id('TTopicCat') and type = 'U') drop table TTopicCat go if exists (select 1 from sysobjects where id = object_id('Tadmingroup') and type = 'U') drop table Tadmingroup go if exists (select 1 from sysobjects where id = object_id('Tadminlog') and type = 'U') drop table Tadminlog go if exists (select 1 from sysobjects where id = object_id('Tattachment') and type = 'U') drop table Tattachment go if exists (select 1 from sysobjects where id = object_id('Tcomment') and type = 'U') drop table Tcomment go if exists (select 1 from sysobjects where id = object_id('Tpurchase') and type = 'U') drop table Tpurchase go if exists (select 1 from sysobjects where id = object_id('Ttopic') and type = 'U') drop table Ttopic go if exists (select 1 from sysobjects where id = object_id('Tuser') and type = 'U') drop table Tuser go if exists (select 1 from sysobjects where id = object_id('Tusergroup') and type = 'U') drop table Tusergroup go /*==============================================================*/ /* Table: TTopicCat */ /*==============================================================*/ create table TTopicCat ( Cid int not null, Cname nchar(10) null, parentid int null, displayorder int null, description nvarchar(500) null, constraint PK_TTOPICCAT primary key (Cid) ) go /*==============================================================*/ /* Table: Tadmingroup */ /*==============================================================*/ create table Tadmingroup ( admingid smallint not null, allowedit bit null, allowlock bit null, allowdelpost bit null, allowdelcom bit null, allowviewip bit null, allowbanip bit null, allowedituser bit null, allowmoduser bit null, allowviewlog bit null, constraint PK_TADMINGROUP primary key (admingid) ) go /*==============================================================*/ /* Table: Tadminlog */ /*==============================================================*/ create table Tadminlog ( adminlogid int not null, uid int null, name char(20) null, ip char(40) null, actiondatetime datetime null, action nvarchar(200) null, note nvarchar(200) null, constraint PK_TADMINLOG primary key (adminlogid) ) go /*==============================================================*/ /* Table: Tattachment */ /*==============================================================*/ create table Tattachment ( aid int not null, uid int not null, tid int not null, postdatetime datetime not null, filename nchar(100) null, descritption nchar(100) null, filesize int not null, pathinserver nchar(100) not null, constraint PK_TATTACHMENT primary key (aid) ) go /*==============================================================*/ /* Table: Tcomment */ /*==============================================================*/ create table Tcomment ( cid int not null, tid int not null, uid int not null, name nchar(20) null, content ntext not null, postdatetime datetime null, postip char(40) not null, layer int null, lastedit nvarchar(50) null, constraint PK_TCOMMENT primary key (cid) ) go /*==============================================================*/ /* Table: Tpurchase */ /*==============================================================*/ create table Tpurchase ( buyID int not null, UID int null, name nchar(20) null, prodsn char(15) null, modelnum char(15) null, adddatetime datetime null, pursDate datetime null, pursbillnum char(15) null, pursAdd nvarchar(150) null, note nvarchar(300) null, constraint PK_TPURCHASE primary key (buyID) ) go /*==============================================================*/ /* Table: Ttopic */ /*==============================================================*/ create table Ttopic ( tid int not null, title nchar(200) null, content ntext null, catid smallint null, uid int null, name nchar(20) null, postdatetime datetime null, postip char(40) null, views int null, replies int null, closed bit null, displayorder int null, constraint PK_TTOPIC primary key (tid) ) go /*==============================================================*/ /* Table: Tuser */ /*==============================================================*/ create table Tuser ( uid int not null, Username char(10) not null, email char(20) not null, name nchar(20) not null, gender tinyint null, adminid tinyint null, groupid tinyint null, groupname nchar(10) null, password char(32) not null, regIP char(40) not null, regdatetime datetime not null, lastip char(40) null, lastvisit datetime null, topiccnt int null, commentcnt int null, note ntext null, constraint PK_TUSER primary key (uid) ) go /*==============================================================*/ /* Table: Tusergroup */ /*==============================================================*/ create table Tusergroup ( groupid smallint not null, radminid smallint null, specialid smallint null, groupname nchar(10) null, allowvisit bit null, allowpost bit null, allowreply bit null, allowview bit null, allowsearch bit null, constraint PK_TUSERGROUP primary key (groupid) ) go

 

 

你可能感兴趣的:(MSSQL)