CREATE   procedure [C6StagingPeriodico].[REPTRIM_WSEIMM_SQL_POS]  
AS 
BEGIN  
exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica WSEIMM_SQL_POS'
delete from FSEI0.FSEI0.[fsei0_pdc].[w6imm]
INSERT INTO FSEI0.FSEI0.[fsei0_pdc].[w6imm]
           ([RETE]
           ,[CODFIS]
           ,[CODCONF]
           ,[TIPCONS]
           ,[SERVAGG]
           ,[ADDIMM]
           ,[STAIMP]
           ,[FLAGPE]
           ,[RENDSEI]
           ,[RENDIMM])
SELECT  [RETE]
      ,[CODFIS]
      ,[CONTRATTO]
      ,[CONSULENZA]
      ,[SERVIZIO_AGGIUNTIVO]
      ,[STATO_ADD_IMMOBILIARE]
      ,[STATO_IMPORTAZIONE]
      ,[FLAG_IN_PERIMETRO]
      ,[RENDICONTO_SEI]
      ,[RENDICONTO_IMM]
  FROM [C6MartPeriodicoImmobiliare].[W6IMM]
  exec [C6StagingPeriodico].[RP_W6LogBatch] 'Replica WSEIMM_SQL_POS'
END