PDC_REPORT_CreazioneDB/sql/storedCollaudo/C6Mart_aggiornaDataValidazione.sql
2025-06-06 19:02:52 +02:00

28 lines
572 B
SQL

-- Schema: C6Mart
-- Stored Procedure: aggiornaDataValidazione
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