/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_constraint.sql **/
 EXEC P_ALTERPK 'PK_IM_INV_REALBALANCE', 'T_IM_INV_REALBALANCE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_REALBALANCE_KEY') CREATE UNIQUE INDEX IDX_IM_INV_REALBALANCE_KEY ON T_IM_INV_REALBALANCE ( FKEYCOL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_REALBALANCE_ORG_ML_WH') CREATE INDEX IDX_IM_REALBALANCE_ORG_ML_WH ON T_IM_INV_REALBALANCE ( FORGID ,FMATERIALID ,FWAREHOUSEID );


 EXEC P_ALTERPK 'PK_IM_INV_REALBALANCE_SP', 'T_IM_INV_REALBALANCE_SP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_REALBALC_SP_KEYCOL') CREATE INDEX IDX_IM_REALBALC_SP_KEYCOL ON T_IM_INV_REALBALANCE_SP ( FKEYCOL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_REALBALC_SP_UPDTIME') CREATE INDEX IDX_IM_REALBALC_SP_UPDTIME ON T_IM_INV_REALBALANCE_SP ( FUPDATETIME  DESC );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_REALBALC_SP_BILLID') CREATE INDEX IDX_IM_REALBALC_SP_BILLID ON T_IM_INV_REALBALANCE_SP ( FBILLID );

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



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