/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_constraint.sql **/
 EXEC P_ALTERPK 'PK_MDS_ADJUSTRECORD', 'T_MDS_ADJUSTRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_ADJUSTRECORD') CREATE INDEX IDX_MDS_ADJUSTRECORD ON T_MDS_ADJUSTRECORD ( FPLANID ,FPROJECTID );


 EXEC P_ALTERPK 'PK_MDS_POLARISSTATUS', 'T_MDS_POLARISSTATUS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_POLARISSTATUS_C') CREATE INDEX IDX_MDS_POLARISSTATUS_C ON T_MDS_POLARISSTATUS ( FCREATEORGID );

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


 EXEC P_ALTERPK 'PK_MDS_POLARISSTATUS_L', 'T_MDS_POLARISSTATUS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_RULESET_RANGE', 'T_MDS_RULESET_RANGE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_RULESETENTITY', 'T_MDS_RULESETENTITY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKSTATUSRULE', 'T_MDS_STOCKSTATUSRULE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKSTATUSRULE_L', 'T_MDS_STOCKSTATUSRULE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKUPRECORD', 'T_MDS_STOCKUPRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_STOCKUPRECORD') CREATE INDEX IDX_MDS_STOCKUPRECORD ON T_MDS_STOCKUPRECORD ( FPLANID ,FPROJECTID );



/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_constraint.sql **/
