CREATE VIEW  [C6MartPeriodicoImmobiliare].[ExcludedList]
AS
select rete as Rete,
case when codicefiscale is not null then CodiceFiscale 
	when piva is not null then PIVA
	when Codman is not null then 'FF@'+Codman
	end as codicefiscale,
	Motivazione_Blacklist as DescrErr,
	Data_Inserimento as DataIns,
	'1' as Bloccato
from C6MartPeriodicoImmobiliare.blacklist