/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HBSS_constraint.sql **/
 EXEC P_ALTERPK 'PK_HBSS_CAPACITYGROUP', 'T_HBSS_CAPACITYGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPACITYGROUP') CREATE INDEX IDX_HBSS_CAPACITYGROUP ON T_HBSS_CAPACITYGROUP ( FNUMBER ,FNAME );


 EXEC P_ALTERPK 'PK_HBSS_CAPACITYGROUP_L', 'T_HBSS_CAPACITYGROUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_CAPACITYITEM', 'T_HBSS_CAPACITYITEM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPACITYITEM') CREATE INDEX IDX_HBSS_CAPACITYITEM ON T_HBSS_CAPACITYITEM ( FNUMBER ,FNAME );


 EXEC P_ALTERPK 'PK_HBSS_CAPACITYITEM_L', 'T_HBSS_CAPACITYITEM_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_CAPITEMACTENTRY', 'T_HBSS_CAPITEMACTENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPITEMACTENTRY') CREATE INDEX IDX_HBSS_CAPITEMACTENTRY ON T_HBSS_CAPITEMACTENTRY ( FID );


 EXEC P_ALTERPK 'PK_HBSS_CAPITEMACTENTRY_L', 'T_HBSS_CAPITEMACTENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPITEMACTENTRY_L') CREATE INDEX IDX_HBSS_CAPITEMACTENTRY_L ON T_HBSS_CAPITEMACTENTRY_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HBSS_CAPITEMRANKENTRY', 'T_HBSS_CAPITEMRANKENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPITEMRANKENTRY') CREATE INDEX IDX_HBSS_CAPITEMRANKENTRY ON T_HBSS_CAPITEMRANKENTRY ( FID ,FRANKNAME );


 EXEC P_ALTERPK 'PK_HBSS_CAPITEMRANKENTRY_L', 'T_HBSS_CAPITEMRANKENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPITEMRANKENTRY_L') CREATE INDEX IDX_HBSS_CAPITEMRANKENTRY_L ON T_HBSS_CAPITEMRANKENTRY_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HBSS_CAPRANKINFOENTRY', 'T_HBSS_CAPRANKINFOENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPRANKINFOENTRY') CREATE INDEX IDX_HBSS_CAPRANKINFOENTRY ON T_HBSS_CAPRANKINFOENTRY ( FID );


 EXEC P_ALTERPK 'PK_HBSS_CAPRANKINFOENTRY_L', 'T_HBSS_CAPRANKINFOENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPRANKINFOENTRY_L') CREATE INDEX IDX_HBSS_CAPRANKINFOENTRY_L ON T_HBSS_CAPRANKINFOENTRY_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HBSS_CAPRANKSCHEME', 'T_HBSS_CAPRANKSCHEME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPRANKSCHEME') CREATE INDEX IDX_HBSS_CAPRANKSCHEME ON T_HBSS_CAPRANKSCHEME ( FNUMBER ,FNAME );


 EXEC P_ALTERPK 'PK_HBSS_CAPRANKSCHEME_L', 'T_HBSS_CAPRANKSCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_CAPACITYACTION_L', 'T_HBSS_CAPACITYACTION_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_CAPACITYACTION', 'T_HBSS_CAPACITYACTION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_CAPACITYACTION') CREATE INDEX IDX_HBSS_CAPACITYACTION ON T_HBSS_CAPACITYACTION ( FNUMBER ,FNAME );



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