帮忙解释一段SQL语句

来源:百度知道 编辑:UC知道 时间:2024/05/15 13:08:19
alter table IpControl
drop constraint FK_IPCONTRO_REFERENCE_VOTEITEM
go

alter table VoteItem
drop constraint FK_VOTEITEM_REFERENCE_VOTETITL
go

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

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

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

alter table IpControl //修改表IpControl
drop constraint FK_IPCONTRO_REFERENCE_VOTEITEM //删除约束
FK_IPCONTRO_REFERENCE_VOTEITEM
go 执行

alter table VoteItem //同上
drop constraint FK_VOTEITEM_REFERENCE_VOTETITL //同上
go

if exists (select 1
from sysobjects
where id = object_id('IpControl')
and type = 'U') //如果用户有名为IpControl的表
drop table IpControl //则删除表 IpControl
go

if exists (select 1
from sysobjects
where id = object_id('VoteItem')
and type = 'U')
drop table VoteItem //同上 删除VoteItem
go

if exists (select 1
from sysobjects
where id = object_id('VoteTitle')
and type = 'U')
drop table VoteTitle //同上,删除VoteTitle
go

alter table IpControl
drop constraint FK_IPCONTRO_REFERENCE_VOTEITEM
go
删除IpControl的 FK_IPCONTRO_REFERENCE_VOTEITEM 约束

alter table Vot