I made a sql script by joining some tables in SQL Server and I will have the result in some fields, but I would like to create a new table and copy everything I have filtered with select into it ... Something like: create table Enderecos_new as my sql script ....).
Would anyone know how to help me?
Thank you:)
Select
loc.loc_nu_sequencial,
CASE
WHEN
loc.cep IS NULL
THEN logr.cep
WHEN
logr.cep IS NULL
THEN loc.cep
ELSE loc.cep
END AS cep,
logr.log_nome,
logr.log_complemento,
log_bairro.bai_no,
loc.loc_no,
loc.ufe_sg
from log_localidade as loc
left join log_logradouro as logr on loc.loc_nu_sequencial = logr.loc_nu_sequencial
left join log_bairro on logr.bai_nu_sequencial_ini = log_bairro.bai_nu_sequencial
order by loc_nu_sequencial