select
'22' as IDENTIFICADOR,
pvfvcodrem as codPedido,
case 
	when pvsta = 'AP' then 1 
	when pvsta = 'AB' then 2 
	when pvsta = 'AA' then 3 
	when pvsta = 'MP' then 4 
	when pvsta = 'MT' then 5 
	when pvsta = 'FT' then 6 
	when pvsta = 'EX' then 7 
end  as codStatus,
pvrcaparcod as codVendedor
from pv
where coalesce(length(pvfvcodrem),0) > 0
order by pvcod
ExecutarScriptSempre
