CREATE procedure [C6MartPeriodico].[GESTIONE_SELECT_SPECIFIC_ZIP]
(@CARTELLA as VARCHAR(255))
as
BEGIN 
       DECLARE @IdZip AS INT
       SET @IdZip = -1
       DECLARE @NomeCartella AS VARCHAR(255)
    Declare @NomeFile    as varchar(50)
    Declare @NumeroCFZip   as int
       SELECT @IdZip=id,@NomeCartella=NomeCartella,@NomeFile =NomeFile
       FROM
              C6MartPeriodico.GESTIONE_ZIP_FTP_IDX
       WHERE
              NomeCartella = @CARTELLA
       IF @IdZip > -1 Begin
             select @NumeroCFZip=count( *)
                     from (
                     select distinct rete,codicefiscale
                     from c6martperiodico.GESTIONE_PDF_FTP_IDX
                     where id_fk_zip=@IdZip) a
   end
              select @IdZip IdZip,@NomeFile NomeFile,@NomeCartella NomeCartella,@NumeroCFZip  NumeroCFZip
END