Fragment according to data on the original table is added

----排序
select max(t.materialmasterpriceid) from d_ss_materialmasterprice t order by t.materialmasterpriceid desc;

--- Copy to create a temporary table
create table d_ss_materialmasterprice12 as select * from d_ss_materialmasterprice8 ;

--- update temporary table ID
Update d_ss_materialmasterprice12 t.materialmasterpriceid = T SET + t.materialmasterpriceid 10000000000;

--- re-copy into a temporary table
insert into d_ss_materialMasterPrice select * from d_ss_materialMasterPrice8;

update d_ss_materialmasterprice8 t set t.materialmasterpriceid = t.materialmasterpriceid+70000000 where t.materialmasterpriceid<10000000;

select max(t.materialmasterpriceid),min(t.materialmasterpriceid) from d_ss_materialmasterprice8 t;
select min(t.materialmasterpriceid) from d_ss_materialMasterPrice8 t;

select count(*) from d_ss_materialMasterPrice8;

--- check whether duplicate id

select t.materialmasterpriceid,count(*) from d_ss_materialmasterprice8  t group by t.materialmasterpriceid having count(*) > 1

----查条数
select count(*) from (select t.materialmasterpriceid,count(*) from d_ss_materialmasterprice8 t group by t.materialmasterpriceid having count(*) > 1);

select count(*) from d_ss_materialMasterPrice;

  ---- delete tables
  drop the Table d_ss_materialmasterpricedtl purge;
  
---- modify the table name
ALTER TABLE d_ss_materialMasterPrice8 RENAME TO d_ss_materialMasterPrice; (uppercase system commands)

--创建价格主数据主键
-- Create/Recreate primary, unique and foreign key constraints 
alter table D_SS_MATERIALMASTERPRICE
  add constraint PK_D_SS_MATERIALMASTERPRICE primary key (MATERIALMASTERPRICEID);
  
  ----创建索引
  -- Create/Recreate indexes 
create index IX_D_SS_MATERIALMASTERPRICE1 on D_SS_MATERIALMASTERPRICE (PRICEKEY)
  tablespace SRMHDL_DATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
create index IX_MATERIALMASTERPRICE1 on D_SS_MATERIALMASTERPRICE (MATERIALCODE, VENDORERPCODE, PURCHASINGGROUPCODE, CLIENTCODE)
  tablespace SRMHDL_DATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
create index IX_MATERIALMASTERPRICE2 on D_SS_MATERIALMASTERPRICE (MATERIALMASTERPRICENO)
  tablespace SRMHDL_DATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
  
  ----细单操作
  ----删除表
  drop table d_ss_materialmasterpricedtl purge;
  ------修改表名
  ALTER TABLE d_ss_materialmasterpricedtl8 RENAME TO d_ss_materialmasterpricedtl;(大写为系统命令);
  ----创建索引
  -- Create/Recreate primary, unique and foreign key constraints 
alter table D_SS_MATERIALMASTERPRICEDTL
  add constraint PK_D_SS_MASTERPRICEDTL primary key (MATERIALMASTERPRICEDTLID)
  using index 
  tablespace SRMHDL_DATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate indexes 
create index IX_D_SS_MATERIALMASTERPRIDTL0 on D_SS_MATERIALMASTERPRICEDTL (MATERIALMASTERPRICEID)
  tablespace SRMHDL_DATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
create index IX_D_SS_MATERIALMASTERPRIDTL1 on D_SS_MATERIALMASTERPRICEDTL (BATCHID)
  tablespace SRMHDL_DATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );


--- updated master table id value plus a one hundred million
update d_ss_materialmasterprice t set t.materialmasterpriceid = t.materialmasterpriceid + 100000000;

--- fine update table id value plus a million thin updated value master table id table plus a million, small table update price. 1
Update d_ss_materialmasterpricedtl t.materialmasterpricedtlid = T SET + 100000000 t.materialmasterpricedtlid, t.materialmasterpriceid = t.materialmasterpriceid + 100000000, t.taxprice = 1;

Guess you like

Origin blog.csdn.net/wxm994116/article/details/93467262