/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_FA_DEPRE_CONVENTION_L', 'T_FA_DEPRE_CONVENTION_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_DEPRESPLITSETUP_L', 'T_FA_DEPRESPLITSETUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_DEPRESPLITSUBENTRY', 'T_FA_DEPRESPLITSUBENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DEPRESPLITSUBENTRY_FID') CREATE INDEX IDX_FA_DEPRESPLITSUBENTRY_FID ON T_FA_DEPRESPLITSUBENTRY ( FENTRYID );


 EXEC P_ALTERPK 'PK_T_FA_MATERASSET_ENTRY', 'T_FA_MATERASSET_ENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_MATERASSET_ENTRY') CREATE INDEX IDX_FA_MATERASSET_ENTRY ON T_FA_MATERASSET_ENTRY ( FID ,FMATIRAILGROUPID );


 EXEC P_ALTERPK 'PK_T_FA_MATERTOASSET', 'T_FA_MATERTOASSET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_MATERTOASSET') CREATE INDEX IDX_FA_MATERTOASSET ON T_FA_MATERTOASSET ( FDEPREUSID );


 EXEC P_ALTERPK 'PK_T_FA_MATERTOASSET_L', 'T_FA_MATERTOASSET_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_DEPRE_CONVENT_ENTRY', 'T_FA_DEPRE_CONVENT_ENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_DEPRESPLITSETUP', 'T_FA_DEPRESPLITSETUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DEPRESPLITSETUP') CREATE INDEX IDX_FA_DEPRESPLITSETUP ON T_FA_DEPRESPLITSETUP ( FORGID ,FDEPREUSEID ,FBEGINPERIODID ,FENDPERIODID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DEPRESPLITSETUPCARD') CREATE INDEX IDX_FA_DEPRESPLITSETUPCARD ON T_FA_DEPRESPLITSETUP ( FREALCARDID );


 EXEC P_ALTERPK 'PK_T_FA_DEPRE_CONVENTION', 'T_FA_DEPRE_CONVENTION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DEPRE_CONVENTION') CREATE INDEX IDX_FA_DEPRE_CONVENTION ON T_FA_DEPRE_CONVENTION ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_FA_DEPRESPLITENTRY', 'T_FA_DEPRESPLITENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_DEPRESUMASS', 'T_FA_DEPRESUMASS', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DEPRESUMASS') CREATE INDEX IDX_FA_DEPRESUMASS ON T_FA_DEPRESUMASS ( FENTRYID );


 EXEC P_ALTERPK 'PK_T_FA_CLEARRSBILL', 'T_FA_CLEARRSBILL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_CLEARRSBILLENTRY', 'T_FA_CLEARRSBILLENTRY', 'FENTRYID', '1';

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



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