/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_HDM_REGBASEBILL', 'T_HDM_REGBASEBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBASEBILL_BILLNO') CREATE INDEX IDX_HDM_REGBASEBILL_BILLNO ON T_HDM_REGBASEBILL ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBASEBILL_ORG') CREATE INDEX IDX_HDM_REGBASEBILL_ORG ON T_HDM_REGBASEBILL ( FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBASEBILL_ERFILEMAN') CREATE INDEX IDX_HDM_REGBASEBILL_ERFILEMAN ON T_HDM_REGBASEBILL ( FERMANFILEID );


 EXEC P_ALTERPK 'PK_HDM_REGBASEBILL_A', 'T_HDM_REGBASEBILL_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBASEBILL_ADMINORG') CREATE INDEX IDX_HDM_REGBASEBILL_ADMINORG ON T_HDM_REGBASEBILL_A ( FBAFFILIATEADMINORGID );


 EXEC P_ALTERPK 'PK_HDM_REGBASEBILL_L', 'T_HDM_REGBASEBILL_L', 'FPKID', '1';

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



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