PDC_REPORT_CreazioneDB/sql/Produzione/procedure/C6Mart_aggiornaDataValidazione.sql
2025-06-10 15:29:00 +02:00

18 lines
504 B
SQL

CREATE procedure [C6Mart].[aggiornaDataValidazione] as
begin
select
DataGenerazione as data,
SUBSTRING(NomeFile, 1, 11) as codiceContratto, --SUBSTRING(NomeFile, 0, 12)
case
when (id_fk_zip = -1) then 0
else 1
end as definitivo,
getDate() as dataAggiornamento
from
(
select
datagenerazione, nomefile,id_fk_zip,
row_number() over (partition by SUBSTRING(NomeFile, 1, 11) order by datagenerazione desc ) pippo from --SUBSTRING(NomeFile, 0, 12)
c6mart.gestione_pdf_ftp
)l where pippo =1
end