/**Begin C:\PDM_UPGRADE\sharepdmdir\sou\pdm1\SOU_constraint.sql **/


 EXEC P_ALTERPK 'PK_BD_SRCSTRATEGY_L', 'T_BD_SRCSTRATEGY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BD_CATEGORYLEVEL', 'T_BD_CATEGORYLEVEL', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_CATEGORYLEVEL_ORG_TIME') CREATE INDEX IDX_BD_CATEGORYLEVEL_ORG_TIME ON T_BD_CATEGORYLEVEL ( FCREATEORGID , FCREATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_CATEGORYLEVEL_CATEGORY') CREATE INDEX IDX_BD_CATEGORYLEVEL_CATEGORY ON T_BD_CATEGORYLEVEL ( FCATEGORYID );

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


 EXEC P_ALTERPK 'PK_BD_CATEGORYLEVEL_L', 'T_BD_CATEGORYLEVEL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BD_CENTRALPURCHASE_ORG', 'T_BD_CENTRALPURCHASE_ORG', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_BD_CENTRALPURCHASELIST', 'T_BD_CENTRALPURCHASELIST', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_CENTRAL_ORG_TIME') CREATE INDEX IDX_BD_CENTRAL_ORG_TIME ON T_BD_CENTRALPURCHASELIST ( FCREATEORGID ,FCREATETIME );


 EXEC P_ALTERPK 'PK_BD_CENTRALPURCHASELIST_L', 'T_BD_CENTRALPURCHASELIST_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BD_PURSTGY_SCH', 'T_BD_PURSTGY_SCH', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_PURSTGY_SCH_ORG_TIME') CREATE INDEX IDX_BD_PURSTGY_SCH_ORG_TIME ON T_BD_PURSTGY_SCH ( FCREATEORGID ,FCREATETIME );

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


 EXEC P_ALTERPK 'PK_BD_PURSTGY_SCH_L', 'T_BD_PURSTGY_SCH_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BD_SRCSTGY_SCHENTRY', 'T_BD_SRCSTGY_SCHENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_BD_PURSTRATEGY', 'T_BD_PURSTRATEGY', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_PURSTRATEGY_ORG_TIME') CREATE INDEX IDX_BD_PURSTRATEGY_ORG_TIME ON T_BD_PURSTRATEGY ( FCREATEORGID ,FCREATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_PURSTRATEGY_CATEGORY') CREATE INDEX IDX_BD_PURSTRATEGY_CATEGORY ON T_BD_PURSTRATEGY ( FCATEGORYID );

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


 EXEC P_ALTERPK 'PK_BD_PURSTRATEGY_L', 'T_BD_PURSTRATEGY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BD_SRCSTGY_SCH', 'T_BD_SRCSTGY_SCH', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_SRCSTGY_SCH_ORG_TIME') CREATE INDEX IDX_BD_SRCSTGY_SCH_ORG_TIME ON T_BD_SRCSTGY_SCH ( FCREATETIME ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_BD_SRCSTGY_SCH_L', 'T_BD_SRCSTGY_SCH_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_BD_SRCSTRATEGY', 'T_BD_SRCSTRATEGY', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_SRCSTRATEGY_ORG_TIME') CREATE INDEX IDX_BD_SRCSTRATEGY_ORG_TIME ON T_BD_SRCSTRATEGY ( FCREATEORGID ,FCREATETIME );

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_SRCSTRATEGY_CATEGORY') CREATE INDEX IDX_BD_SRCSTRATEGY_CATEGORY ON T_BD_SRCSTRATEGY ( FCATEGORYID );


 
 EXEC p_DropIdx 'IDX_BD_CENTRAL_REQ_TYPE', 'T_BD_CENTRALPURCHASE_ORG';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_CENTRAL_REQ_TYPE') CREATE INDEX IDX_BD_CENTRAL_REQ_TYPE ON T_BD_CENTRALPURCHASE_ORG ( FBIZTYPE );

 EXEC P_ALTERPK 'PK_BD_PURCHASEENTRY_SCH', 'T_BD_PURCHASEENTRY_SCH', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_PURCHASEENTRY_SCH') CREATE INDEX IDX_BD_PURCHASEENTRY_SCH ON T_BD_PURCHASEENTRY_SCH ( FID ,FENTRYREQORGID );


 EXEC P_ALTERPK 'PK_BD_PURCHASEORG_SCH', 'T_BD_PURCHASEORG_SCH', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PURCHASEORG_SCH_ORG_TIME') CREATE INDEX IDX_PURCHASEORG_SCH_ORG_TIME ON T_BD_PURCHASEORG_SCH ( FCREATEORGID , FCREATETIME );


 EXEC P_ALTERPK 'PK_BD_PURCHASEORG_SCH_L', 'T_BD_PURCHASEORG_SCH_L', 'FPKID', '1';

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



/**End C:\PDM_UPGRADE\sharepdmdir\sou\pdm1\SOU_constraint.sql **/
