-- =============================================
-- Author:		Hazem
-- Create date: 09/06/2010
-- Description:	Selecta white list packages
-- =============================================
CREATE procedure [C6MartPeriodico].[GESTIONE_SELECT_ZIP_WHITELIST]
AS
BEGIN
	declare @lotto as smallint
	select @lotto =    max(IDElaborazioneZIP) FROM C6MartPeriodico.ELABORAZIONI_ZIP WHERE  DataFine IS NOT NULL
	SELECT 
		id as IdZip,
		@lotto as lotto,
		nomeFile
	FROM
		C6MartPeriodico.GESTIONE_ZIP_FTP
	WHERE
		--DataInvio >= C6MartPeriodico.getTrimestre(GETDATE(),0) 
		--AND
		--id = 998 and 
		fkIDElaborazioneZIP = @lotto--(SELECT max(IDElaborazioneZIP) FROM C6MartPeriodico.ELABORAZIONI_ZIP WHERE DataFine IS NOT NULL)
END