CREATE procedure [C6StagingPeriodico].[REPTRIM_TANAB]  
AS 
BEGIN  
exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica TANAB'
TRUNCATE TABLE [C6StagingPeriodico].[TANAB]
INSERT INTO [C6StagingPeriodico].[TANAB]
           ([RETE]
           ,[CODAREA]
           ,[CODPROG]
           ,[CODFIS]
           ,[DTRIF]
           ,[DTFINE]
           ,[DTINI]
           ,[CTVINI]
           ,[DTRENDMAX]
           ,[RENDMAX]
           ,[DTRENDMIN]
           ,[RENDMIN]
           ,[DTCTV]
           ,[CTV]
           ,[RENDATT]
           ,[DTCTVMAX]
           ,[CTVMAX]
           ,[DTCTVMIN]
           ,[CTVMIN]
           ,[CVN]
           ,[CVN_IA]
           ,[CVN_IT]
           ,[APP_INI]
           ,[TOT_APP]
           ,[TOT_LIQ]
           ,[TOT_CED]
           ,[TOT_DIV]
           ,[DCD]
           ,[DCVN]
           ,[SCARTO]
           ,[NTOT_APP]
           ,[NTOT_LIQ]
           ,[RENDATTANN])
SELECT [RETE]
      ,[CODAREA]
      ,[CODPROG]
      ,[CODFIS]
      ,[DTRIF]
      ,[DTFINE]
      ,[DTINI]
      ,[CTVINI]
      ,[DTRENDMAX]
      ,[RENDMAX]
      ,[DTRENDMIN]
      ,[RENDMIN]
      ,[DTCTV]
      ,[CTV]
      ,[RENDATT]
      ,[DTCTVMAX]
      ,[CTVMAX]
      ,[DTCTVMIN]
      ,[CTVMIN]
      ,[CVN]
      ,[CVN_IA]
      ,[CVN_IT]
      ,[APP_INI]
      ,[TOT_APP]
      ,[TOT_LIQ]
      ,[TOT_CED]
      ,[TOT_DIV]
      ,[DCD]
      ,[DCVN]
      ,[SCARTO]
      ,[NTOT_APP]
      ,[NTOT_LIQ]
      ,[RENDATTANN]
  FROM FSEI0.FSEI0.[fsei0_pdc].[tanab]
  exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica TANAB'
END