/*==============================================================*/
/* DBMS name: Microsoft SQL Server 2000 */
/* Created on: 2007-12-12 21:12:51 */
/*==============================================================*/
alter table sfd
drop constraint FK_SFD_RELATIONS_USERINFO
go
alter table sfd
drop constraint FK_SFD_RELATIONS_SFY
go
if exists (select 1
from sysindexes
where id = object_id('sfd')
and name = 'Relationship_1_FK'
and indid > 0
and indid < 255)
drop index sfd.Relationship_1_FK
go
if exists (select 1
from sysindexes
where id = object_id('sfd')
and name = 'Relationship_2_FK'
and indid > 0
and indid < 255)
drop index sfd.Relationship_2_FK
go
if exists (select 1
from sysobjects
where id = object_id('sfd')
and type = 'U')
drop table sfd
go
if exists (select 1
from sysobjects
where id = object_id('sfy')
and type = 'U')
drop table sfy
go
if exists (select 1
from sysobjects
where id = object_id('userinfo')
and type = 'U')
drop table userinfo
go
/*==============================================================*/
/* Table: sfd */
/*==============================================================*/
create table sfd (
Sfd_ID int not null,
Sfy_ID int null,
User_ID int null,
Sfd_Money money null,
Sfd_Time datetime null,
Sfd_Station varchar(20) null,
constraint PK_SFD primary key nonclustered (Sfd_ID)
)
go
declare @Cmtsfd varchar(128)
select @Cmtsfd = user_name()
execute sp_addextendedproperty 'MS_Description',
'收费单',
'user', @Cmtsfd, 'table', 'sfd'
go
/*==============================================================*/
/* Index: Relationship_1_FK */
/*==============================================================*/
create index Relationship_1_FK on sfd (
User_ID ASC
)
go
/*==============================================================*/
/* Index: Relationship_2_FK */
/*==============================================================*/
create index Relationship_2_FK on sfd (
Sfy_ID ASC
)
go
/*==============================================================*/
/* Table: sfy */
/*==============================================================*/
create table sfy (
Sfy_ID int not null,
Sfy_Name varchar(20) null,
Sfy_Bz numeric(1) null,
Sfy_Bc char(2) null,
constraint PK_SFY primary key nonclustered (Sfy_ID)
)
go
declare @Cmtsfy varchar(128)
select @Cmtsfy = user_name()
execute sp_addextendedproperty 'MS_Description',
'收费员表',
'user', @Cmtsfy, 'table', 'sfy'
go
/*==============================================================*/
/* Table: userinfo */
/*==============================================================*/
create table userinfo (
User_ID int not null,
User_Name varchar(20) null,
User_Pwd varchar(20) null,
User_Right numeric(1) null,
constraint PK_USERINFO primary key nonclustered (User_ID)
)
go
declare @Cmtuserinfo varchar(128)
select @Cmtuserinfo = user_name()
execute sp_addextendedproperty 'MS_Description',
'用户表',
'user', @Cmtuserinfo, 'table', 'userinfo'
go
alter table sfd
add constraint FK_SFD_RELATIONS_USERINFO foreign key (User_ID)
references userinfo (User_ID)
go
alter table sfd
add constraint FK_SFD_RELATIONS_SFY foreign key (Sfy_ID)
references sfy (Sfy_ID)
go