update t11 set p30=replace(p30, '#', '#@');
/*peg_end*/

update t11, z_tameia_t11
set    t11.p02   = z_tameia_t11.p02, 
       t11.p03   = z_tameia_t11.p03, 
       t11.p04   = z_tameia_t11.p04, 
       t11.p05   = z_tameia_t11.p05, 
       t11.p06   = z_tameia_t11.p06, 
       t11.p07   = z_tameia_t11.p07, 
       t11.p08   = z_tameia_t11.p08, 
       t11.p09   = z_tameia_t11.p09, 
       t11.p010  = z_tameia_t11.p010, 
       t11.p012  = z_tameia_t11.p012, 
       t11.p014  = z_tameia_t11.p014, 
       t11.p015  = z_tameia_t11.p015, 
       t11.p201  = z_tameia_t11.p201, 
       t11.p30   = z_tameia_t11.p30 
       
where t11.p01=z_tameia_t11.p01;
/*peg_end*/

insert into t11
(nr01, p01 , p02, p03, p04, p05, p06, p07, p08, p09, p010, p012, p014, p015, p201, p30,
remdate, remtime, remuser, remfdate, remftime, remfuser)

select z_tameia_t11.nr01 as nr01, 
       z_tameia_t11.p01 as p01,
       z_tameia_t11.p02 as p02,
       z_tameia_t11.p03 as p03,
       z_tameia_t11.p04 as p04,
       z_tameia_t11.p05 as p05,
       z_tameia_t11.p06 as p06,
       z_tameia_t11.p07 as p07,
       z_tameia_t11.p08 as p08,
       z_tameia_t11.p09 as p09,
       z_tameia_t11.p010 as p010,
       z_tameia_t11.p012 as p012,
       z_tameia_t11.p014 as p014,
       z_tameia_t11.p015 as p015,
       z_tameia_t11.p201 as p201,
       z_tameia_t11.p30 as p30,

       curdate() as remdate, 
       curtime() as remtime, 
       z_tameia_t11.remuser as remuser, 
       z_tameia_t11.remfdate as remfdate, 
       z_tameia_t11.remftime as remftime, 
       z_tameia_t11.remfuser as remfuser 

from z_tameia_t11
LEFT JOIN t11 ON t11.p01=z_tameia_t11.p01
WHERE t11.nr01 is null;
/*peg_end*/

