/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\GL_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_AI_MIDLEBIZVOUCHER', 'T_AI_MIDLEBIZVOUCHER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AI_MIDLEBIZVOUCHER' AND KSQL_INDNAME = 'IDX_AI_MIDBIZVCH_BIZVCHID') CREATE INDEX IDX_AI_MIDBIZVCH_BIZVCHID ON T_AI_MIDLEBIZVOUCHER ( FBIZVOUCHERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AI_MIDLEBIZVOUCHER' AND KSQL_INDNAME = 'IDX_AI_MIDBIZVCH_VCHID') CREATE INDEX IDX_AI_MIDBIZVCH_VCHID ON T_AI_MIDLEBIZVOUCHER ( FVOUCHERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AI_MIDLEBIZVOUCHER' AND KSQL_INDNAME = 'IDX_AI_MIDBIZVCH_SRCID') CREATE INDEX IDX_AI_MIDBIZVCH_SRCID ON T_AI_MIDLEBIZVOUCHER ( FSOURCEBILLID ,FBILLTYPE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AI_MIDLEBIZVOUCHER' AND KSQL_INDNAME = 'IDX_AI_MIDBIZVCH_ORGPERID') CREATE INDEX IDX_AI_MIDBIZVCH_ORGPERID ON T_AI_MIDLEBIZVOUCHER ( FORGID ,FPERIODID );



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