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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_BP_FMATERIEL') CREATE INDEX IDX_PUR_BP_FMATERIEL ON T_PUR_BLUEPRINT_SHARE ( FMATERIELID );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_BP_FCREATETIME') CREATE INDEX IDX_PUR_BP_FCREATETIME ON T_PUR_BLUEPRINT_SHARE ( FCREATETIME );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_BP_FISLATESTVERSION') CREATE INDEX IDX_PUR_BP_FISLATESTVERSION ON T_PUR_BLUEPRINT_SHARE ( FISLATESTVERSION );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_BP_FORG_FMATERIEL') CREATE INDEX IDX_PUR_BP_FORG_FMATERIEL ON T_PUR_BLUEPRINT_SHARE ( FCREATEORGID ,FMATERIELID );


EXEC P_ALTERPK 'PK_T_PUR_BULEPRINTENTRY', 'T_PUR_BULEPRINTENTRY', 'FENTRYID', '1';

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

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


EXEC P_ALTERPK 'PK_T_PUR_ORDER_FEEDBACKATTA', 'T_PUR_ORDER_FEEDBACKATTA', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_ORDERENTRY_FBASEDATAID') CREATE INDEX IDX_PUR_ORDERENTRY_FBASEDATAID ON T_PUR_ORDER_FEEDBACKATTA ( FBASEDATAID );

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


EXEC P_ALTERPK 'PK_T_PUR_BLUEPRINT_SHARE_L', 'T_PUR_BLUEPRINT_SHARE_L', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_PUR_BLUEPRINTGROUP', 'T_PUR_BLUEPRINTGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_BP_GROUP_NUM_NAME') CREATE INDEX IDX_PUR_BP_GROUP_NUM_NAME ON T_PUR_BLUEPRINTGROUP ( FNUMBER ,FNAME );


EXEC P_ALTERPK 'PK_T_PUR_BLUEPRINTGROUP_L', 'T_PUR_BLUEPRINTGROUP_L', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_T_PUR_ORDERCHANGE_ATTA', 'T_PUR_ORDERCHANGE_ATTA', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_ORDERCHANGE_FBASEID') CREATE INDEX IDX_PUR_ORDERCHANGE_FBASEID ON T_PUR_ORDERCHANGE_ATTA ( FBASEDATAID );

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





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