/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BCM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BCM_ACCOUNTDIMENSION', 'T_BCM_ACCOUNTDIMENSION', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_ACCTDIM') CREATE INDEX IDX_BCM_ACCTDIM ON T_BCM_ACCOUNTDIMENSION ( FDEFINDIMSENSION );


 EXEC P_ALTERPK 'PK_T_BCM_ACCOUNTMETRIC', 'T_BCM_ACCOUNTMETRIC', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_ACCOUNTMETRIC') CREATE INDEX IDX_BCM_ACCOUNTMETRIC ON T_BCM_ACCOUNTMETRIC ( FMETRIC );


 EXEC P_ALTERPK 'PK_T_BCM_DATETYPEEDITCYCLE', 'T_BCM_DATETYPEEDITCYCLE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATETYPEEDITCYCLE') CREATE INDEX IDX_BCM_DATETYPEEDITCYCLE ON T_BCM_DATETYPEEDITCYCLE ( FDATATYPEMEMID );


 EXEC P_ALTERPK 'PK_T_BCM_MEMBOFDATETYPE_L', 'T_BCM_MEMBOFDATETYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATETYPE_L2') CREATE INDEX IDX_BCM_DATETYPE_L2 ON T_BCM_MEMBOFDATETYPE_L ( FID );


 EXEC P_ALTERPK 'PK_T_BCM_MEMBOFDATTTYPE', 'T_BCM_MEMBOFDATTTYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATETYPE_MEM_NUM') CREATE INDEX IDX_BCM_DATETYPE_MEM_NUM ON T_BCM_MEMBOFDATTTYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFDATETYPE', 'T_BCM_STRUCTOFDATETYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATETYPE_MODEL') CREATE INDEX IDX_BCM_DATETYPE_MODEL ON T_BCM_STRUCTOFDATETYPE ( FMODELID );


 EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFDATETYPE_L', 'T_BCM_STRUCTOFDATETYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATETYPE_L') CREATE INDEX IDX_BCM_DATETYPE_L ON T_BCM_STRUCTOFDATETYPE_L ( FID );


 EXEC P_ALTERPK 'PK_T_BCM_METRIC', 'T_BCM_METRIC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_TYPE') CREATE INDEX IDX_BCM_METRIC_TYPE ON T_BCM_METRIC ( FTYPE );


 EXEC P_ALTERPK 'PK_T_BCM_LINKAGE', 'T_BCM_LINKAGE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_LINKAGE') CREATE INDEX IDX_BCM_LINKAGE ON T_BCM_LINKAGE ( FMODELID ,FSCENARIOID ,FNUMBER );


 EXEC P_ALTERPK 'PK_T_BCM_RIGHTINFO', 'T_BCM_RIGHTINFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BCM_RIGHTINFO_ACCT') CREATE INDEX IDX_T_BCM_RIGHTINFO_ACCT ON T_BCM_RIGHTINFO ( FRIGHTACCOUNT );


 EXEC P_ALTERPK 'PK_T_BCM_RIGHTINFOENTRY', 'T_BCM_RIGHTINFOENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BCM_RIGHTINFOENTRY_FID') CREATE INDEX IDX_T_BCM_RIGHTINFOENTRY_FID ON T_BCM_RIGHTINFOENTRY ( FID );


 EXEC P_ALTERPK 'PK_T_BCM_LINKAGEENTRY', 'T_BCM_LINKAGEENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_LINKAGEENTRY') CREATE INDEX IDX_BCM_LINKAGEENTRY ON T_BCM_LINKAGEENTRY ( FTEMPLATEID );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BCM_constraint.sql **/
