CREATE procedure [C6StagingPeriodico].[REPTRIM_W6CLIESG]  
AS 
BEGIN  
exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica W6CLIESG'
TRUNCATE TABLE [C6StagingPeriodico].[W6CLIESG]
INSERT INTO [C6StagingPeriodico].[W6CLIESG]
           ( [DTTRIM]
			,[RETE]
			,[CODFIS]
			,[CODMAN]
			,[U_PREFSOST]
			,[FLAGSFDR]
			,[FLAGTAXO]
			,[FLAGPAI]
			,[SFDR_PERC]
			,[TAXO_PERC]
			,[PAI_A01]
			,[PAI_A02]
			,[PAI_A03]
			,[PAI_A04]
			,[PAI_A05]
			,[PAI_A07]
			,[PAI_A08]
			,[PAI_S01]
			,[PAI_S02]
			,[PAI_NO_DETT]
			,[PERC1ESG]
			,[PERCAMB]
			,[PERCSOC]
			,[PERCGOV]
			,[PERCAMB_OK]
			,[PERCSOC_OK]
			,[PERCGOV_OK]
			,[SFDR_PERCT]
			,[SFDR_PERC_OK]
			,[TAXO_PERCT]
			,[TAXO_PERC_OK]
			,[PAIA_PERCT]
			,[PAIA_PERC_OK]
			,[PAIS_PERCT]
			,[PAIS_PERC_OK])
SELECT [DTTRIM]
      ,[RETE]
      ,[CODFIS]
      ,[CODMAN]
      ,[U_PREFSOST]
      ,[FLAGSFDR]
      ,[FLAGTAXO]
      ,[FLAGPAI]
      ,[SFDR_PERC]
      ,[TAXO_PERC]
      ,[PAI_A01]
      ,[PAI_A02]
      ,[PAI_A03]
      ,[PAI_A04]
      ,[PAI_A05]
      ,[PAI_A07]
      ,[PAI_A08]
      ,[PAI_S01]
      ,[PAI_S02]
      ,[PAI_NO_DETT]
      ,[PERC1ESG]
      ,[PERCAMB]
      ,[PERCSOC]
      ,[PERCGOV]
      ,[PERCAMB_OK]
      ,[PERCSOC_OK]
      ,[PERCGOV_OK]
      ,[SFDR_PERCT]
      ,[SFDR_PERC_OK]
      ,[TAXO_PERCT]
      ,[TAXO_PERC_OK]
      ,[PAIA_PERCT]
      ,[PAIA_PERC_OK]
      ,[PAIS_PERCT]
      ,[PAIS_PERC_OK]
  FROM FSEI0.sfsei0.[fsei0_pdc].[w6cliesg]
  exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica W6CLIESG'
END