/*==============================================================*/
/* DBMS name: Microsoft SQL Server 2005 */
/* Created on: 2017/1/2 14:27:57 */
/*==============================================================*/
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('Book') and o.name = 'FK_BOOK_REFERENCE_BORROW')
alter table Book
drop constraint FK_BOOK_REFERENCE_BORROW
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('Book') and o.name = 'FK_BOOK_REFERENCE_PENALTY')
alter table Book
drop constraint FK_BOOK_REFERENCE_PENALTY
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('Borrow') and o.name = 'FK_BORROW_REFERENCE_READER')
alter table Borrow
drop constraint FK_BORROW_REFERENCE_READER
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('Reader') and o.name = 'FK_READER_REFERENCE_PENALTY')
alter table Reader
drop constraint FK_READER_REFERENCE_PENALTY
go
if exists (select 1
from sysobjects
where id = object_id('Book')
and type = 'U')
drop table Book
go
if exists (select 1
from sysobjects
where id = object_id('Borrow')
and type = 'U')
drop table Borrow
go
if exists (select 1
from sysobjects
where id = object_id('Penalty')
and type = 'U')
drop table Penalty
go
if exists (select 1
from sysobjects
图书管理.sql
最新推荐文章于 2024-05-14 19:37:13 发布