/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_constraint.sql **/
 EXEC P_ALTERPK 'PK_MDS_STOCK_CABIN', 'T_MDS_STOCK_CABIN', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCK_CHECK', 'T_MDS_STOCK_CHECK', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCK_CUS', 'T_MDS_STOCK_CUS', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCK_SCHD', 'T_MDS_STOCK_SCHD', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKRANEENTITY', 'T_MDS_STOCKRANEENTITY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKRANGEDEF', 'T_MDS_STOCKRANGEDEF', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKRANGEDEF_L', 'T_MDS_STOCKRANGEDEF_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKSTATUS', 'T_MDS_STOCKSTATUS', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_MDS_STOCKSTATUS_L', 'T_MDS_STOCKSTATUS_L', 'FPKID', '1';

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



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