/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BD_PRODUCTDEFINITION', 'T_BD_PRODUCTDEFINITION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTDEFINITION' AND KSQL_INDNAME = 'IDX_PRODUCTDEFINITION_FNUM') CREATE INDEX IDX_PRODUCTDEFINITION_FNUM ON T_BD_PRODUCTDEFINITION ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTDEFINITION_L', 'T_BD_PRODUCTDEFINITION_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTDEFINITION_L' AND KSQL_INDNAME = 'IDX_BD_PRODUCTDEFINITION_L_FID') CREATE INDEX IDX_BD_PRODUCTDEFINITION_L_FID ON T_BD_PRODUCTDEFINITION_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTFAMILY', 'T_BD_PRODUCTFAMILY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTFAMILY' AND KSQL_INDNAME = 'IDX_BD_PRODUCTFAMILY_NUM') CREATE INDEX IDX_BD_PRODUCTFAMILY_NUM ON T_BD_PRODUCTFAMILY ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTFAMILY_L', 'T_BD_PRODUCTFAMILY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTFAMILY_L' AND KSQL_INDNAME = 'IDX_BD_PRODUCTFAMILY_L_FID') CREATE INDEX IDX_BD_PRODUCTFAMILY_L_FID ON T_BD_PRODUCTFAMILY_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTHIERARCHY', 'T_BD_PRODUCTHIERARCHY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTHIERARCHY' AND KSQL_INDNAME = 'IDX_BD_PRODUCTHIERARCHY_NUM') CREATE INDEX IDX_BD_PRODUCTHIERARCHY_NUM ON T_BD_PRODUCTHIERARCHY ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTHIERARCHY_L', 'T_BD_PRODUCTHIERARCHY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTHIERARCHY_L' AND KSQL_INDNAME = 'IDX_BD_PRODUCTHIERARCHY_L_FID') CREATE INDEX IDX_BD_PRODUCTHIERARCHY_L_FID ON T_BD_PRODUCTHIERARCHY_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTLINE', 'T_BD_PRODUCTLINE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTLINE' AND KSQL_INDNAME = 'IDX_BD_PRODUCTLINE_NUM') CREATE INDEX IDX_BD_PRODUCTLINE_NUM ON T_BD_PRODUCTLINE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTLINE_L', 'T_BD_PRODUCTLINE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTLINE_L' AND KSQL_INDNAME = 'IDX_BD_PRODUCTLINE_L_FID') CREATE INDEX IDX_BD_PRODUCTLINE_L_FID ON T_BD_PRODUCTLINE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTMODEL', 'T_BD_PRODUCTMODEL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTMODEL' AND KSQL_INDNAME = 'IDX_BD_PRODUCTMODEL_NUM') CREATE INDEX IDX_BD_PRODUCTMODEL_NUM ON T_BD_PRODUCTMODEL ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTMODEL_L', 'T_BD_PRODUCTMODEL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTMODEL_L' AND KSQL_INDNAME = 'IDX_BD_PRODUCTMODEL_L_FID') CREATE INDEX IDX_BD_PRODUCTMODEL_L_FID ON T_BD_PRODUCTMODEL_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTSERIES', 'T_BD_PRODUCTSERIES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTSERIES' AND KSQL_INDNAME = 'IDX_BD_PRODUCTSERIES_NUM') CREATE INDEX IDX_BD_PRODUCTSERIES_NUM ON T_BD_PRODUCTSERIES ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_PRODUCTSERIES_L', 'T_BD_PRODUCTSERIES_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_PRODUCTSERIES_L' AND KSQL_INDNAME = 'IDX_BD_PRODUCTSERIES_L_FID') CREATE INDEX IDX_BD_PRODUCTSERIES_L_FID ON T_BD_PRODUCTSERIES_L ( FID ,FLOCALEID );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_constraint.sql **/
