-- Schema: dbo
-- Stored Procedure: SO_getNewSubscriptions

CREATE procedure [dbo].[SO_getNewSubscriptions]
	@ultimaDataRilevata_ISODATE as varchar(8)

AS

BEGIN

	DECLARE @the_date datetime
	SET @the_date = CAST(@ultimaDataRilevata_ISODATE AS DATETIME)

SELECT 
		[Cod_Fiscale],
      	[CodiceContratto],
      	[Cod_Agente],
		[Rete],
		dbo.ToShortDateString([Data_Perf]) as data_perfezionamento_C6,
		dbo.ToShortDateString([data_fineAvanzato] )as data_chiusura_C6
FROM  [C6Mart].[CONTRATTOSEI]
	
WHERE Data_Perf > @the_date
ORDER BY data_perf
END


