--
--                                                  
--  Job j204_sum_email1 -  fill table t204_sum_email_ids   
--                                                  
--

drop table t204_sum_email_ids
/

create table t204_sum_email_ids
     ( a_uid_c    varchar(08)   null
     , a_badge_n  char(10)      null
     , a_uid_x    varchar(30)   null
     , a_email_x  varchar(25)   null
     )
/


insert into t204_sum_email_ids
select a_uid_c   
     , a_badge_n
     , substr(a_uid_x,1,30) 
     , rtrim(a_uid_c)||'@nsc.com'
  from t204_web_summary
where a_uid_c    > ' '
  and a_uid_c   <> 'TBLHSC'
  and a_uid_c   <> 'CGJEUK'
  and a_uid_c   <> 'D2FNSC'
  and a_badge_n not like 'EXT000%'
  and f_pd01_a  <> 0
  and f_bill_x  not like 'Cingular%'
order by a_badge_n
       , a_uid_c
/


select 'Number of valid ids: ', count(*)
  from t204_sum_email_ids
/ 

exit;
