CREATE procedure [C6MartPeriodico].[GESTIONE_INSERT_ZIP_IDX_NOINSERT]
@NomeCartella as varchar(255)
AS
bEGIN
--select id IdZip, NomeFile, NomeCartella
--from [C6MartPeriodico].[GESTIONE_ZIP_FTP_idx] where nomecartella = @NomeCartella
declare @c as varchar(1)
set @c = '['
declare @path as varchar(max)
set @path =  @NomeCartella
declare @nomefile as varchar(100)
declare @id as int
set @nomefile = substring(@path, 0, charindex('_LOTTO',@path))
set @id = cast( substring(@path,  charindex('_PACK_',@path)+6, charindex(@c,@path)-(charindex('_PACK_',@path)+6)) as int)
select id IdZip, @NomeCartella as NomeFile, NomeCartella
from [C6MartPeriodico].[GESTIONE_ZIP_FTP]
where  nomefile = @nomefile and id = @id
end