/**Begin D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKSCENE', 'T_BCM_DATALOCKSCENE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKSCENE' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKSCENE') CREATE INDEX IDX_BCM_DATALOCKSCENE ON T_BCM_DATALOCKSCENE ( FMODELID ,FSCENEID );


 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKSCENE_L', 'T_BCM_DATALOCKSCENE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKSCENE_L' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKSCENE_L') CREATE INDEX IDX_BCM_DATALOCKSCENE_L ON T_BCM_DATALOCKSCENE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKPLAN', 'T_BCM_DATALOCKPLAN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKPLAN' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKPLAN') CREATE INDEX IDX_BCM_DATALOCKPLAN ON T_BCM_DATALOCKPLAN ( FMODELID ,FSCENEID );


 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKPLAN_L', 'T_BCM_DATALOCKPLAN_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKPLAN_L' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKPLAN_L') CREATE INDEX IDX_BCM_DATALOCKPLAN_L ON T_BCM_DATALOCKPLAN_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKPLANENTRY', 'T_BCM_DATALOCKPLANENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKPLANENTRY' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKPLANENTRY') CREATE INDEX IDX_BCM_DATALOCKPLANENTRY ON T_BCM_DATALOCKPLANENTRY ( FID );


 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKPLANPERIOD', 'T_BCM_DATALOCKPLANPERIOD', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKPLANPERIOD' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKPLANPERIOD') CREATE INDEX IDX_BCM_DATALOCKPLANPERIOD ON T_BCM_DATALOCKPLANPERIOD ( FENTRYID );


 EXEC P_ALTERPK 'PK_T_BCM_DATALOCKSETTING', 'T_BCM_DATALOCKSETTING', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_DATALOCKSETTING' AND KSQL_INDNAME = 'IDX_BCM_DATALOCKSETTING') CREATE INDEX IDX_BCM_DATALOCKSETTING ON T_BCM_DATALOCKSETTING ( FMODELID ,FPLANID ,FSUBMITSTAGEID );



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