/**Begin D:\DBA\PDM_UPGRADE\PDM1\BCM_constraint.sql **/


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DCOLLECT_GROUP') CREATE INDEX IDX_BCM_DCOLLECT_GROUP ON T_BCM_DATACOLLECT ( FGROUPID ,FCOLLECTSTATUS );

 EXEC P_ALTERPK 'PK_T_BCM_DATACOLLECTPLAN', 'T_BCM_DATACOLLECTPLAN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DCOLLECT_PLAN') CREATE INDEX IDX_BCM_DCOLLECT_PLAN ON T_BCM_DATACOLLECTPLAN ( FMODEL ,FPLANNAME );


 EXEC P_ALTERPK 'PK_T_BCM_DATACOLLECTPLAN_L', 'T_BCM_DATACOLLECTPLAN_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATACOLLECTPLAN_L') CREATE INDEX IDX_BCM_DATACOLLECTPLAN_L ON T_BCM_DATACOLLECTPLAN_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BCM_DATACOLLECTRECORD', 'T_BCM_DATACOLLECTRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_DATACOLLECTRECORD') CREATE INDEX IDX_BCM_DATACOLLECTRECORD ON T_BCM_DATACOLLECTRECORD ( FGROUP ,FMODEL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_COLLECTRECORD_QUERY') CREATE INDEX IDX_BCM_COLLECTRECORD_QUERY ON T_BCM_DATACOLLECTRECORD ( FMODEL ,FCREATOR ,FSCENARIO ,FYEAR ,FPERIOD );



/**End D:\DBA\PDM_UPGRADE\PDM1\BCM_constraint.sql **/
