您的位置:首页 > 数据库

酒店管理.sql

2017-01-02 16:09 351 查看
/*==============================================================*/
/* DBMS name:      Microsoft SQL Server 2005                    */
/* Created on:     2017/1/2 14:56:12                            */
/*==============================================================*/

if exists (select 1
from sysobjects
where id = object_id('Kehu')
and type = 'TR')
drop trigger Kehu
go

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('kefang') and o.name = 'FK_KEFANG_REFERENCE_ROOMSTAT')
alter table kefang
drop constraint FK_KEFANG_REFERENCE_ROOMSTAT
go

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('kefang') and o.name = 'FK_KEFANG_REFERENCE_ROOMTYPE')
alter table kefang
drop constraint FK_KEFANG_REFERENCE_ROOMTYPE
go

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('kehu') and o.name = 'FK_KEHU_REFERENCE_KEFANG')
alter table kehu
drop constraint FK_KEHU_REFERENCE_KEFANG
go

if exists (select 1
from  sysobjects
where  id = object_id('RoomState')
and   type = 'U')
drop table RoomState
go

if exists (select 1
from  sysobjects
where  id = object_id('RoomType')
and   type = 'U')
drop table RoomType
go

if exists (select 1
from  sysobjects
where  id = object_id('kefang')
and   type = 'U')
drop table kefang
go

if exists (select 1
from  sysobjects
where  id = object_id('kehu')
and   type = 'U')
drop table kehu
go

/*==============================================================*/
/* Table: RoomState                                             */
/*==============================================================*/
create table RoomState (
RoomStateID          int                  not null,
RoomStateName        varchar(10)          null,
constraint PK_ROOMSTATE primary key (RoomStateID)
)
go

/*=====================================
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: