/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BD_PROJECTKIND', 'T_BD_PROJECTKIND', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BD_PROJECTKIND_NUMBER') CREATE  CLUSTERED INDEX IDX_T_BD_PROJECTKIND_NUMBER ON T_BD_PROJECTKIND ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PROJECTKIND_A', 'T_BD_PROJECTKIND_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BD_PROKIND_OUTBUDGET') CREATE INDEX IDX_T_BD_PROKIND_OUTBUDGET ON T_BD_PROJECTKIND_A ( FOUTBUDGETTPLID );


 EXEC P_ALTERPK 'PK_T_BD_PROJECTKIND_L', 'T_BD_PROJECTKIND_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_PROJECTKINDENTRY_L', 'T_BD_PROJECTKINDENTRY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_PROJECTSTATUS', 'T_BD_PROJECTSTATUS', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BD_PROJECTSTATUS_NUMBER') CREATE  CLUSTERED INDEX IDX_T_BD_PROJECTSTATUS_NUMBER ON T_BD_PROJECTSTATUS ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PROJECTSTATUS_L', 'T_BD_PROJECTSTATUS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_PROJECTKINDENTRY', 'T_BD_PROJECTKINDENTRY', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_PROJECTKINDENTRY_FID') CREATE  CLUSTERED INDEX IDX_BD_PROJECTKINDENTRY_FID ON T_BD_PROJECTKINDENTRY ( FID );



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