/**Begin C:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
EXEC P_ALTERPK 'PK_PUR_DELIVERYSCHEDULE', 'T_PUR_DELIVERYSCHEDULE', 'FID', '1';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_DS_FBILLDATE') CREATE INDEX IDX_PUR_DS_FBILLDATE ON T_PUR_DELIVERYSCHEDULE ( FBILLDATE );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_DS_FBIZPARTNERID') CREATE INDEX IDX_PUR_DS_FBIZPARTNERID ON T_PUR_DELIVERYSCHEDULE ( FBIZPARTNERID );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_DS_FSUPPLIERID') CREATE INDEX IDX_PUR_DS_FSUPPLIERID ON T_PUR_DELIVERYSCHEDULE ( FSUPPLIERID );


EXEC P_ALTERPK 'PK_PUR_DELIVERYSCHENTRY', 'T_PUR_DELIVERYSCHENTRY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_DSRENTRY_FID_FSEQ') CREATE INDEX IDX_PUR_DSRENTRY_FID_FSEQ ON T_PUR_DELIVERYSCHENTRY ( FID ,FSEQ );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_DSENTRY_FMATERIALID') CREATE INDEX IDX_PUR_DSENTRY_FMATERIALID ON T_PUR_DELIVERYSCHENTRY ( FMATERIALID );


EXEC P_ALTERPK 'PK_PUR_DELIVERYSCHEDULE_L', 'T_PUR_DELIVERYSCHEDULE_L', 'FPKID', '1';

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



/**End C:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
