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

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

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SRM_ORDERSYNC_FORGID') CREATE INDEX IDX_SRM_ORDERSYNC_FORGID ON T_SRM_ORDER_SYNC ( FORGID );


 EXEC P_ALTERPK 'PK_SRM_ORDER_SYNCENTITY', 'T_SRM_ORDER_SYNCENTITY', 'FENTRYID', '1';

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

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


 EXEC P_ALTERPK 'PK_SRM_RECEIPT_SYNC', 'T_SRM_RECEIPT_SYNC', 'FID', '1';

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

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SRM_RECEIPTSYNC_FORGID') CREATE INDEX IDX_SRM_RECEIPTSYNC_FORGID ON T_SRM_RECEIPT_SYNC ( FORGID );


 EXEC P_ALTERPK 'PK_SRM_RECEIPT_SYNCENTITY', 'T_SRM_RECEIPT_SYNCENTITY', 'FENTRYID', '1';

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SRM_RECEIPTENTRY_FPOBILLNO') CREATE INDEX IDX_SRM_RECEIPTENTRY_FPOBILLNO ON T_SRM_RECEIPT_SYNCENTITY ( FPOBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SRM_RECEIPTENTRY_FPOBILLID') CREATE INDEX IDX_SRM_RECEIPTENTRY_FPOBILLID ON T_SRM_RECEIPT_SYNCENTITY ( FPOBILLID );


 EXEC P_ALTERPK 'PK_SRM_INSPECTBILL', 'T_SRM_INSPECTBILL', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SRM_INBILLSYNC_FINDATE') CREATE INDEX IDX_SRM_INBILLSYNC_FINDATE ON T_SRM_INSPECTBILL ( FINSPEENDDATE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SRM_INBILLSYNC_FORGID') CREATE INDEX IDX_SRM_INBILLSYNC_FORGID ON T_SRM_INSPECTBILL ( FORGID );


 EXEC P_ALTERPK 'PK_SRM_INSPECTENTITY', 'T_SRM_INSPECTENTITY', 'FENTRYID', '1';

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

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

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



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