/*Insert paramétrage  CS  AO*/
insert into <PREFIXE_HA>PARAMDICO  (TYPEDICO,ID1,ID2,ID3,ID4,LIBELLE,ALPHA1,ALPHA2,ALPHA3,ALPHA4)   
(select 'OXAETL','PAR_CS',COD_TAB,cast(NUM_FIX as char),'',NOM,'AO_LIGNES_DETAIL','0',t.FORMAT,t.ALP_LONG    from <PREFIXE_HA>CS_CHPS c WITH (NOLOCK)  
left outer join <PREFIXE_HA>CS_TYPES t WITH (NOLOCK) on c.TYPE=t.TYPE  
left outer join <PREFIXE_HA>PARAMDICO p WITH (NOLOCK) on p.ID2=c.COD_TAB and cast(p.ID3 as int)=c.NUM_FIX 
where COD_TAB like 'AO%' and TYPEDICO is null) 
<SEPARATEUR>
update p set ALPHA4=cast(t.PE_LONG as varchar)+case when t.PD_LONG<>0 then '.'+cast(t.PD_LONG as varchar) else '' end
from <PREFIXE_HA>PARAMDICO p , <PREFIXE_HA>CS_CHPS c , <PREFIXE_HA>CS_TYPES t where p.TYPEDICO='OXAETL' and ID1='PAR_CS' and ID2=c.COD_TAB and cast(ID3 as int)=c.NUM_FIX and c.TYPE=t.TYPE and ALPHA3='N'
 