/**Begin D:\PDM_UPGRADE\PDM1\BCM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BCM_EXTENDDATA', 'T_BCM_EXTENDDATA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_EXTENDDATA') CREATE INDEX IDX_BCM_EXTENDDATA ON T_BCM_EXTENDDATA ( FMODELNUMBER ,FDATAMODEL ,FSCENE ,FYEAR ,FPERIOD );


 EXEC P_ALTERPK 'PK_T_BCM_EXTENDDATA_BUS', 'T_BCM_EXTENDDATA_BUS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_EXTDATABUS') CREATE INDEX IDX_BCM_EXTDATABUS ON T_BCM_EXTENDDATA_BUS ( FMODELNUMBER ,FDATAMODEL ,FSCENE ,FYEAR ,FPERIOD );


 EXEC P_ALTERPK 'PK_T_BCM_DIMENSION_EXT', 'T_BCM_DIMENSION_EXT', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_DIMENSION_EXT_L', 'T_BCM_DIMENSION_EXT_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_MEMBOFEXTEND', 'T_BCM_MEMBOFEXTEND', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_MEMBOFEXT') CREATE INDEX IDX_BCM_MEMBOFEXT ON T_BCM_MEMBOFEXTEND ( FMODELID ,FDIMENSIONID );


 EXEC P_ALTERPK 'PK_T_BCM_MEMBOFEXTEND_L', 'T_BCM_MEMBOFEXTEND_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFEXTEND', 'T_BCM_STRUCTOFEXTEND', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_STRUCTOFEXT') CREATE INDEX IDX_BCM_STRUCTOFEXT ON T_BCM_STRUCTOFEXTEND ( FMODELID ,FDIMENSIONID );


 EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFEXTEND_L', 'T_BCM_STRUCTOFEXTEND_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_EXTENDSMODEL', 'T_BCM_EXTENDSMODEL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_EXTENDSMODEL_L', 'T_BCM_EXTENDSMODEL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_EXTMODELFIELD', 'T_BCM_EXTMODELFIELD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_EXTMODFIELD') CREATE INDEX IDX_BCM_EXTMODFIELD ON T_BCM_EXTMODELFIELD ( FEXTMODELID );


 EXEC P_ALTERPK 'PK_T_BCM_EXTMODELDIM', 'T_BCM_EXTMODELDIM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_EXTMODDIM') CREATE INDEX IDX_BCM_EXTMODDIM ON T_BCM_EXTMODELDIM ( FEXTMODELID );


 EXEC P_ALTERPK 'PK_T_BCM_EXTMODELREF', 'T_BCM_EXTMODELREF', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_EXTMODREF_E') CREATE INDEX IDX_BCM_EXTMODREF_E ON T_BCM_EXTMODELREF ( FEXTMODELID );

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



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