内容发布更新时间 : 2025/1/3 18:13:39星期一 下面是文章的全部内容请认真阅读。
图书馆管理系统建模设计
由PDM对象自动生成的数据库脚本文件代码如下:
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('books') and o.name = 'FK_BOOKS_管理书籍_ADMIN') alter table books
drop constraint FK_BOOKS_管理书籍_ADMIN go
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F') where r.fkeyid =
object_id('borrow_information') and o.name = 'FK_BORROW_I_BORROW_IN_BOOKS') alter table borrow_information drop constraint
FK_BORROW_I_BORROW_IN_BOOKS go
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and
o.type = 'F') where r.fkeyid =
object_id('borrow_information') and o.name = 'FK_BORROW_I_BORROW_IN_READER') alter table borrow_information drop constraint
FK_BORROW_I_BORROW_IN_READER go
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('login') and o.name = 'FK_LOGIN_LOGIN_ADMIN') alter table login
drop constraint FK_LOGIN_LOGIN_ADMIN go
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('login') and o.name = 'FK_LOGIN_LOGIN2_READER') alter table login
drop constraint FK_LOGIN_LOGIN2_READER go
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F') where r.fkeyid =
object_id('reversation') and o.name = 'FK_REVERSAT_REVERSATI_BOOKS') alter table reversation drop constraint
FK_REVERSAT_REVERSATI_BOOKS go
if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F') where r.fkeyid =
object_id('reversation') and o.name = 'FK_REVERSAT_REVERSATI_READER') alter table reversation drop constraint
FK_REVERSAT_REVERSATI_READER go
if exists (select 1
from sysindexes
where id = object_id('admin')
and name = '权限_FK' and indid > 0 and indid < 255) drop index admin.权限_FK go
if exists (select 1
from sysobjects where id = object_id('admin')
and type = 'U') drop table admin go
if exists (select 1
from sysindexes where id = object_id('books')
and name = '管理书籍_FK' and indid > 0 and indid < 255) drop index books.管理书籍_FK go
if exists (select 1
from sysindexes where id = object_id('books')
and name = '图书类型_FK' and indid > 0 and indid < 255) drop index books.图书类型_FK go
if exists (select 1
from sysobjects where id = object_id('books')
and type = 'U') drop table books go
if exists (select 1
from sysobjects where id = object_id('booktype')
and type = 'U') drop table booktype go
if exists (select 1
from sysindexes where id = object_id('borrow_information') and name = 'Association_2_FK'
and indid > 0 and indid < 255)
drop index
borrow_information.Association_2_FK go
if exists (select 1
from sysindexes where id = object_id('borrow_information') and name = 'Association_1_FK'
and indid > 0 and indid < 255) drop index
borrow_information.Association_1_FK go
if exists (select 1
from sysobjects where id =
object_id('borrow_information') and type = 'U') drop table borrow_information go
if exists (select 1
from sysindexes where id = object_id('login')
and name = 'login2_FK' and indid > 0 and indid < 255)