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('T_PA_ACCTOBJ') and o.name = 'FK_T_PA_ACC_FK_T_PA_A_T_PA_FEE')
alter table T_PA_ACCTOBJ
drop constraint FK_T_PA_ACC_FK_T_PA_A_T_PA_FEE
go
if exists (select 1
from sysindexes
where id = object_id('T_PA_ACCTOBJ')
and name = 'IDX_PA_ACCTOBJ_FSTAFFID'
and indid > 0
and indid < 255)
drop index T_PA_ACCTOBJ.IDX_PA_ACCTOBJ_FSTAFFID
go
if exists (select 1
from sysindexes
where id = object_id('T_PA_ACCTOBJ')
and name = 'IDX_PA_ACCTOBJ_FSALARY'
and indid > 0
and indid < 255)
drop index T_PA_ACCTOBJ.IDX_PA_ACCTOBJ_FSALARY
go
if exists (select 1
from sysindexes
where id = object_id('T_PA_ACCTOBJ')
and name = 'IDX_PA_ACCTOBJ_FKFID'
and indid > 0
and indid < 255)
drop index T_PA_ACCTOBJ.IDX_PA_ACCTOBJ_FKFID
go
if exists (select 1
from sysindexes
where id = object_id('T_PA_ACCTOBJ')
and name = 'IDX_PA_ACCTOBJ_PERSONID'
and indid > 0
and indid < 255)
drop index T_PA_ACCTOBJ.IDX_PA_ACCTOBJ_PERSONID
go
if exists (select 1
from sysindexes
where id = object_id('T_PA_ACCTOBJ')
and name = 'IDX_PA_ACCTOBJ_PAYOBJID'
and indid > 0
and indid < 255)
drop index T_PA_ACCTOBJ.IDX_PA_ACCTOBJ_PAYOBJID
go
if exists (select 1
from sysobjects
where id = object_id('T_PA_ACCTOBJ')
and type = 'U')
drop table T_PA_ACCTOBJ
go
/*==============================================================*/
/* Table: T_PA_ACCTOBJ */
/*==============================================================*/
create table T_PA_ACCTOBJ (
FENTRYID int not null default 0,
FID int not null default 0,
FPAYOBJID int not null default 0,
FFEEALLOCATEID int null default 0,
FPERIODTIME int null,
FPERSONID int not null default 0,
FSTAFFID int not null default 0,
FMGRCENTERID int null,
FAUDITSTATUS char(1) not null default '0',
FPROVIDESTATUS char(1) not null default 'A',
FFEEALCSTATUS char(1) not null default '0',
FSALARID int null default 0,
FHRPOSTID int null default 0,
FUNITID int null default 0,
FORGID int null default 0,
FEMPINFOID int null default 0,
constraint PK_PA_ACCTOBJ primary key (FENTRYID)
)
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'期次的年+期+次组合而成的int值,只要用于期间端的数据查询',
'user', @CurrentUser, 'table', 'T_PA_ACCTOBJ', 'column', 'FPERIODTIME'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'0:未审核
1:已审核',
'user', @CurrentUser, 'table', 'T_PA_ACCTOBJ', 'column', 'FAUDITSTATUS'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'A:未发放
B:进入发放
C:已生成发放
D:已发放',
'user', @CurrentUser, 'table', 'T_PA_ACCTOBJ', 'column', 'FPROVIDESTATUS'
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'0:未分配
1:已分配
',
'user', @CurrentUser, 'table', 'T_PA_ACCTOBJ', 'column', 'FFEEALCSTATUS'
go
/*==============================================================*/
/* Index: IDX_PA_ACCTOBJ_PAYOBJID */
/*==============================================================*/
create index IDX_PA_ACCTOBJ_PAYOBJID on T_PA_ACCTOBJ (
FPAYOBJID ASC
)
go
/*==============================================================*/
/* Index: IDX_PA_ACCTOBJ_PERSONID */
/*==============================================================*/
create index IDX_PA_ACCTOBJ_PERSONID on T_PA_ACCTOBJ (
FPERSONID ASC
)
go
/*==============================================================*/
/* Index: IDX_PA_ACCTOBJ_FKFID */
/*==============================================================*/
create index IDX_PA_ACCTOBJ_FKFID on T_PA_ACCTOBJ (
FID ASC
)
go
/*==============================================================*/
/* Index: IDX_PA_ACCTOBJ_FSALARY */
/*==============================================================*/
create index IDX_PA_ACCTOBJ_FSALARY on T_PA_ACCTOBJ (
FSALARID ASC
)
go
/*==============================================================*/
/* Index: IDX_PA_ACCTOBJ_FSTAFFID */
/*==============================================================*/
create index IDX_PA_ACCTOBJ_FSTAFFID on T_PA_ACCTOBJ (
FSTAFFID ASC
)
go
alter table T_PA_ACCTOBJ
add constraint FK_T_PA_ACC_FK_T_PA_A_T_PA_FEE foreign key (FFEEALLOCATEID)
references T_PA_FEEALLOCATE (FFEEALLOCATEID)
go
|