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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TASKTEMPLATE' AND KSQL_INDNAME = 'IDX_BCM_TASKTEMPLATE') CREATE INDEX IDX_BCM_TASKTEMPLATE ON T_BCM_TASKTEMPLATE ( FNUMBER ,FMODELID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TASKTEMPLATE' AND KSQL_INDNAME = 'IDX_BCM_TASKTEMPLATEMC') CREATE INDEX IDX_BCM_TASKTEMPLATEMC ON T_BCM_TASKTEMPLATE ( FMODELID ,FCOMEFROMID );


 EXEC P_ALTERPK 'PK_T_BCM_TASKTEMPLATE_L', 'T_BCM_TASKTEMPLATE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLFILTERDIM', 'T_BCM_TASKTPLFILTERDIM', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLDISDIMENSION', 'T_BCM_TASKTPLDISDIMENSION', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLSCENE', 'T_BCM_TASKTPLSCENE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLACTENTRY', 'T_BCM_TASKTPLACTENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLACTIVITY', 'T_BCM_TASKTPLACTIVITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TASKTPLACTIVITY' AND KSQL_INDNAME = 'IDX_BCM_TASKTPLACTIVITY') CREATE INDEX IDX_BCM_TASKTPLACTIVITY ON T_BCM_TASKTPLACTIVITY ( FTASKTEMPLATEID );


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLACTIVITY_L', 'T_BCM_TASKTPLACTIVITY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLACTMSG', 'T_BCM_TASKTPLACTMSG', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKTPLACTTEMPLATE', 'T_BCM_TASKTPLACTTEMPLATE', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKRECORD', 'T_BCM_TASKRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TASKRECORD' AND KSQL_INDNAME = 'IDX_BCM_TASKRECORD') CREATE INDEX IDX_BCM_TASKRECORD ON T_BCM_TASKRECORD ( FMODELID ,FSTATUS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TASKRECORD' AND KSQL_INDNAME = 'IDX_BCM_TASKRECORD_B') CREATE INDEX IDX_BCM_TASKRECORD_B ON T_BCM_TASKRECORD ( FBEGINTIME );


 EXEC P_ALTERPK 'PK_T_BCM_TASKRECORDFILTERMEM', 'T_BCM_TASKRECORDFILTERMEM', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TASKRECORDFILTERMEM' AND KSQL_INDNAME = 'IDX_BCM_TASKRECORDFMEM_M') CREATE INDEX IDX_BCM_TASKRECORDFMEM_M ON T_BCM_TASKRECORDFILTERMEM ( FMEMBERID );


 EXEC P_ALTERPK 'PK_T_BCM_TASKRECORDTEMPL', 'T_BCM_TASKRECORDTEMPL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_TASKRECORD_L', 'T_BCM_TASKRECORD_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_USERTASK', 'T_BCM_USERTASK', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_USERTASK' AND KSQL_INDNAME = 'IDX_BCM_USERTASK') CREATE INDEX IDX_BCM_USERTASK ON T_BCM_USERTASK ( FTASKRECORDID );


 EXEC P_ALTERPK 'PK_T_BCM_USERTASKINFO', 'T_BCM_USERTASKINFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_USERTASKINFO' AND KSQL_INDNAME = 'IDX_BCM_USERTASKINFO') CREATE INDEX IDX_BCM_USERTASKINFO ON T_BCM_USERTASKINFO ( FUSERTASKID ,FACTIVITYID );



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