/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_SM_RETURNAPPLY', 'T_SM_RETURNAPPLY', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_SM_RETURNAPPLY_C', 'T_SM_RETURNAPPLY_C', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_SM_RETURNAPPLY_C_CUS') CREATE INDEX IDX_T_SM_RETURNAPPLY_C_CUS ON T_SM_RETURNAPPLY_C ( FCUSTOMERID );


 EXEC P_ALTERPK 'PK_T_SM_RETURNAPPLY_F', 'T_SM_RETURNAPPLY_F', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_SM_RETURNAPPLY_F_ORG') CREATE INDEX IDX_T_SM_RETURNAPPLY_F_ORG ON T_SM_RETURNAPPLY_F ( FSETTLEORGID );


 EXEC P_ALTERPK 'PK_T_SM_RETURNAPPLY_L', 'T_SM_RETURNAPPLY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_SM_RETURNAPPLYENTRY_F', 'T_SM_RETURNAPPLYENTRY_F', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_SM_RETURNAPPLYENTRY', 'T_SM_RETURNAPPLYENTRY', 'FENTRYID', '1';

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



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