/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SBD_constraint.sql **/
 EXEC P_ALTERPK 'PK_MSBD_KITBOM', 'T_MSBD_KITBOM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOM' AND KSQL_INDNAME = 'IDX_MSBD_KITBOM_FNUMBER') CREATE INDEX IDX_MSBD_KITBOM_FNUMBER ON T_MSBD_KITBOM ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOM' AND KSQL_INDNAME = 'IDX_MSBD_KITBOM_FTYPEID') CREATE INDEX IDX_MSBD_KITBOM_FTYPEID ON T_MSBD_KITBOM ( FTYPEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOM' AND KSQL_INDNAME = 'IDX_MSBD_KITBOM_FVERSIONID') CREATE INDEX IDX_MSBD_KITBOM_FVERSIONID ON T_MSBD_KITBOM ( FVERSIONID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOM' AND KSQL_INDNAME = 'IDX_MSBD_KITBOM_FMATERIAL') CREATE INDEX IDX_MSBD_KITBOM_FMATERIAL ON T_MSBD_KITBOM ( FMATERIALID );


 EXEC P_ALTERPK 'PK_MSBD_KITBOM_L', 'T_MSBD_KITBOM_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MSBD_KITBOMENTRY', 'T_MSBD_KITBOMENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOMENTRY' AND KSQL_INDNAME = 'IDX_MSBD_KBOMENTRY_VALIDDATE') CREATE INDEX IDX_MSBD_KBOMENTRY_VALIDDATE ON T_MSBD_KITBOMENTRY ( FVALIDDATE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOMENTRY' AND KSQL_INDNAME = 'IDX_MSBD_KBOMENTRY_INVALIDDATE') CREATE INDEX IDX_MSBD_KBOMENTRY_INVALIDDATE ON T_MSBD_KITBOMENTRY ( FINVALIDDATE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOMENTRY' AND KSQL_INDNAME = 'IDX_MSBD_KBOMENTRY_MATERIAL') CREATE INDEX IDX_MSBD_KBOMENTRY_MATERIAL ON T_MSBD_KITBOMENTRY ( FMATERIALID );


 EXEC P_ALTERPK 'PK_MSBD_KITBOMENTRY_L', 'T_MSBD_KITBOMENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_MSBD_KITBOMENTRY_L' AND KSQL_INDNAME = 'IDX_MSBD_KITBOMENTRY_L_FID') CREATE INDEX IDX_MSBD_KITBOMENTRY_L_FID ON T_MSBD_KITBOMENTRY_L ( FENTRYID ,FLOCALEID );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SBD_constraint.sql **/
