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('web_WebStatistics') and o.name = 'FK_WEB_WEBS_REFERENCE_WEB_ALLI')
alter table web_WebStatistics
drop constraint FK_WEB_WEBS_REFERENCE_WEB_ALLI
go
if exists (select 1
from sysobjects
where id = object_id('web_AllianceCompany')
and type = 'U')
drop table web_AllianceCompany
go
if exists (select 1
from sysobjects
where id = object_id('web_WebStatistics')
and type = 'U')
drop table web_WebStatistics
go
/*==============================================================*/
/* Table: web_AllianceCompany */
/*==============================================================*/
create table web_AllianceCompany (
ACid int identity,
ACname varchar(50) not null,
ACinfo varchar(500) null,
ACwebsite varchar(100) not null,
BankAccount varchar(100) not null,
DeleteStates int not null default 0,
Ctime datetime not null default getdate(),
constraint PK_WEB_ALLIANCECOMPANY primary key (ACid)
)
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'0正常1删除2回收站',
'user', @CurrentUser, 'table', 'web_AllianceCompany', 'column', 'DeleteStates'
go
/*==============================================================*/
/* Table: web_WebStatistics */
/*==============================================================*/
create table web_WebStatistics (
WSid int identity,
ACid int null,
IsOrders bigint null default 0,
IPAddr varchar(50) null,
Vctime datetime null,
Vetime datetime null,
VAddr text null,
constraint PK_WEB_WEBSTATISTICS primary key (WSid)
)
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'0否1是',
'user', @CurrentUser, 'table', 'web_WebStatistics', 'column', 'IsOrders'
go
alter table web_WebStatistics
add constraint FK_WEB_WEBS_REFERENCE_WEB_ALLI foreign key (ACid)
references web_AllianceCompany (ACid)
go