﻿CREATE procedure [wh].[MERGED_PROCEDURE_S43]
AS
BEGIN
	SET NOCOUNT ON;
	INSERT INTO WH.PL_S43LineaSelfBF
	SELECT 'C6MartPeriodico.PL_S43LineaSelfBF' as ProcedureName, LS.rete as i_rete ,LS.codfis as i_codiceFiscale, 	  	 	 
		 codconf as NumContratto,
		 isnull(ctv,0) as Controvalore,
--INIZIO Intervento Eligo Titoli		 
		 NomeProdotto as NomeProdotto,
--FINE   Intervento Eligo Titoli		 		 
		 dbo.ToShortDateString(cast(datasott as varchar))  as DataSott
	FROM       
		C6MartPeriodico.ANAG_SELF LS	
	WHERE 
		isnull(ctv,0) < 0
END