/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BD_BILLOPCONTROL', 'T_BD_BILLOPCONTROL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_BILLOPCONTROL' AND KSQL_INDNAME = 'IDX_BD_BILLOPCONTROL_OBJECT') CREATE INDEX IDX_BD_BILLOPCONTROL_OBJECT ON T_BD_BILLOPCONTROL ( FOBJECT );


 EXEC P_ALTERPK 'PK_T_BD_BILLOPCONTROL_L', 'T_BD_BILLOPCONTROL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_BILLOPCTROLENTITY', 'T_BD_BILLOPCTROLENTITY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_CUSWHITELIST', 'T_BD_CUSWHITELIST', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_CUSWHITELIST' AND KSQL_INDNAME = 'IDX_BD_CUSWHITELIST_ID') CREATE INDEX IDX_BD_CUSWHITELIST_ID ON T_BD_CUSWHITELIST ( FENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_CUSWHITELIST' AND KSQL_INDNAME = 'IDX_BD_CUSWHITELIST_BASE') CREATE INDEX IDX_BD_CUSWHITELIST_BASE ON T_BD_CUSWHITELIST ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_T_BD_SUPWHITELIST', 'T_BD_SUPWHITELIST', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_SUPWHITELIST' AND KSQL_INDNAME = 'IDX_BD_SUPWHITELIST_ID') CREATE INDEX IDX_BD_SUPWHITELIST_ID ON T_BD_SUPWHITELIST ( FENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_SUPWHITELIST' AND KSQL_INDNAME = 'IDX_BD_SUPWHITELIST_BASE') CREATE INDEX IDX_BD_SUPWHITELIST_BASE ON T_BD_SUPWHITELIST ( FBASEDATAID );



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