CREATE    procedure [C6StagingPeriodico].[REPTRIM_WSEIDC]  
AS 
BEGIN  
exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica WSEIDC'
TRUNCATE TABLE [C6StagingPeriodico].[WSEIDC]
INSERT INTO [C6StagingPeriodico].[WSEIDC]
           ([RETE]
           ,[DTTRIM]
           ,[CODFIS]
           ,[CODANA]
           ,[CODMAN]
           ,[CODAGE]
           ,[INTEST]
           ,[CODCONF]
           ,[SUBPROD]
           ,[DTLETT]
           ,[SEX]
           ,[INDIR]
           ,[CAP]
           ,[CITTA]
           ,[PROV]
           ,[NAZION]
           ,[PRESSO]
           ,[TIPCONTR]
		   ,[TEMPLATE]
		   ,[TIPOLETT]
		   )
SELECT [RETE]
      ,[DTTRIM]
      ,[CODFIS]
      ,[CODANA]
      ,[CODMAN]
      ,[CODAGE]
      ,[INTEST]
      ,[CODCONF]
      ,[SUBPROD]
      ,[DTLETT]
      ,[SEX]
      ,[INDIR]
      ,[CAP]
      ,[CITTA]
      ,[PROV]
      ,[NAZION]
      ,[PRESSO]
      ,[TIPCONTR]
	  ,[TEMPLATE]
		   ,[TIPOLETT]
  FROM FSEI0.sfsei0.[fsei0_pdc].[wseidc]
  --UNION
  --SELECT [RETE]
  --    ,[DTTRIM]
  --    ,[CODFIS]
  --    ,[CODANA]
  --    ,[CODMAN]
  --    ,[CODAGE]
  --    ,[INTEST]
  --    ,[CODCONF]
  --    ,[SUBPROD]
  --    ,[DTLETT]
  --    ,[SEX]
  --    ,[INDIR]
  --    ,[CAP]
  --    ,[CITTA]
  --    ,[PROV]
  --    ,[NAZION]
  --    ,[PRESSO]
  --    ,[TIPCONTR]
  --FROM FSEI0.FSEI0.[fsei0_pdc].[w6dbdc]
  exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica WSEIDC'
END