-- Schema: C6MartPeriodico
-- Stored Procedure: CheckQuadraturaRfa0Mifid


-- Stored procedure
-- =============================================
-- Author:		Fabrizio Caruso
-- Create date: 10/01/2014
-- Description:	Controllo Quadratura Rfa0-Mifid
-- =============================================
CREATE procedure [C6MartPeriodico].[CheckQuadraturaRfa0Mifid]
AS
BEGIN
	

	truncate TABLE dbo.CheckQuadraturaProfiloRfaMifid 
	
	
insert into dbo.CheckQuadraturaProfiloRfaMifid 
	Select a.*
    from (
select rete as Rete,cod_fiscale as Codice_Fiscale,'MIFID-Manca su lista Fideuram' as Tipo_Controllo,getdate() as Data_Operazione 
from C6MartPeriodico.CONTROLLO_TRIMESTRALE_PROFILO_SCADUTO
except
select rete as Rete,codfis as Codice_Fiscale,'MIFID-Manca su lista Fideuram' as  Tipo_Controllo ,getdate() as Data_Operazione  
from  dbo.CheckMifidScirocco
) as a

insert into dbo.CheckQuadraturaProfiloRfaMifid 
	Select a.*
    from (
select rete as Rete,codfis as Codice_Fiscale,'MIFID-Manca su lista HP' as Tipo_Controllo,getdate() as Data_Operazione 
from dbo.CheckMifidScirocco
except
select rete as Rete,cod_fiscale as Codice_Fiscale,'MIFID-Manca su lista HP' as  Tipo_Controllo ,getdate() as Data_Operazione  
from  C6MartPeriodico.CONTROLLO_TRIMESTRALE_PROFILO_SCADUTO
) as a


insert into dbo.CheckQuadraturaProfiloRfaMifid 
Select a.*
    from (
select rete as Rete,cod_fiscale as Codice_Fiscale,'RFA0-Manca su lista Fideuram' as Tipo_Controllo,getdate() as Data_Operazione 
from C6MartPeriodico.CONTROLLO_TRIMESTRALE_RFA_ZERO
except
select rete as Rete,codfis as Codice_Fiscale,'RFA0-Manca su lista Fideuram' as  Tipo_Controllo ,getdate() as Data_Operazione  
from  dbo.CheckRfaScirocco
) as a

insert into dbo.CheckQuadraturaProfiloRfaMifid 
Select a.*
    from (
select rete as Rete,codfis as Codice_Fiscale,'RFA0-Manca su lista HP' as Tipo_Controllo,getdate() as Data_Operazione 
from dbo.CheckRfaScirocco
except
select rete as Rete,cod_fiscale as Codice_Fiscale,'RFA0-Manca su lista HP' as  Tipo_Controllo ,getdate() as Data_Operazione  
from  C6MartPeriodico.CONTROLLO_TRIMESTRALE_RFA_ZERO
) as a


END






