2025-06-26 18:47:11 +02:00

60 lines
1.4 KiB
Transact-SQL

-- [dbo].[sp_getNote_ByNoteId] 55377,2
CREATE PROCEDURE [dbo].[sp_getNote_ByNoteId]
@noteId as int,
@pdfC6 as int
AS
BEGIN
SET NOCOUNT ON;
--V modificata non sovrascriverla
--se il report non è storico è nel repository 0:RM 1:C6 2:DM 5:PROPOSTA_VALIDATA il note ID è l'indentificativo del report
IF(@pdfC6 = 0)
BEGIN
Select dataGenerazione as DtCreazione, note
from repositoryMetadati
where idInRepository = @noteId and repository = 0
END
ELSE IF(@pdfC6 = 1)
BEGIN
Select dataGenerazione as DtCreazione, note
from repositoryMetadati
where idInRepository = @noteId and repository = 1
END
ELSE IF(@pdfC6 = 2)
BEGIN
Select dataGenerazione as DtCreazione, note
from repositoryMetadati
where idInRepository = @noteId and repository = 2
END
ELSE IF(@pdfC6 = 5)
BEGIN
Select dataGenerazione as DtCreazione, note
from repositoryMetadati
where idInRepository = @noteId and repository = 5
END
ELSE
--altrimenti è l'identificativo dei metadati
-- @pdfC6 = 3,4
BEGIN
Select dataGenerazione as DtCreazione, note
from repositoryMetadati
where id = @noteId
END
/* V vecchia gestione prima della storicizzazione
IF(@pdfC6 = 0)
BEGIN
SELECT
[DtCreazione]
,[Note]
FROM [dbo].[ReportperClienteDati]
WHERE [Identificativo] = @noteId
END
ELSE
BEGIN
SELECT
Data as DtCreazione
,'Report centralizzato' as Note
FROM [dbo].[C6REPORTFISICO]
WHERE [Identificativo] = @noteId
END
*/
END