select
'15' as IDENTIFICADOR,
cast(procod as text)||lpad(cast(uvecod as text),5,'0') as codigo,
'300'||cast(scatcod as varchar) as codGrupoProduto,
promarcascod as codMarca,
prodes||' - '||uvedes as descricao,
trunc((estqtde-estqtdebloq-estqtderes-estqtdediverg-estqtdepend)/uvemult) as saldoEstoque,
uveun as unidadeVenda,
null as precoVenda,
1 as permiteDesconto,
'',
'',
null as codTamanho,
'',
'',
'',
'',
'',
null as campoLivre1,
null as campoLivre2,
null as campoLivre3,
case when uvedispven = 'S' then 1 else 0 end as ativo,
null as qtdeMinimaPorPedido,
proref as referencia,
case when est.estusacontrolelote = 'S' then 1 else 0 end as controlePorLote,
pro.proncm as codNCM,
null as precoPauta,
pro.proobs as observacao,
pro.proobs as observacaoLojaVirtual,
null as dataEstoque,
null as segmentosRelacionados,
null as codProdutoPrincipal,
null as descProdutoPrincipal,
null as codSegmentoGrade,
null as codTipoGradeVariacao1,
null as codTipoGradeVariacao2,
null as codTipoGradeVariacao3,
null as codTipoGradeVariacao4,
uve.uvecodbar as codigoBarras

from pro
left join scat on scatcod=proscatcod
left join cat on catcod=procatcod
left join secp on secpcod=catsecpcod
left join depp on secpdeppcod=deppcod
join marcas on promarcascod=marcascod
join est on procod=estprocod and estempparcod = 1 and estdispb2b = 'S'
join uve on uveprocod=estprocod and uvedispven='S' --and uvedispb2b = 'S'
where 1=1
order by procod
ExecutarScriptSempre
