2025-06-25 11:25:55 +02:00

19 lines
653 B
Transact-SQL

CREATE PROCEDURE [dbo].[sp_getLastSavedUserModel]
@pIdReportModello as int,
@pUtente as varchar(13) = null,
@pTpReport as int
AS
BEGIN
if @pUtente is not null
SELECT TOP (1) IdReport, Nome, Descrizione
FROM Report
WHERE (Utente = @pUtente) AND (Nome NOT LIKE '%LAST USED CONFIG%')
AND (IdReportModello = @pIdReportModello) AND (TpReport = @pTpReport)
ORDER BY DtCreazione DESC
else
SELECT TOP (1) IdReport, Nome, Descrizione
FROM Report
WHERE Nome NOT LIKE '%LAST USED CONFIG%'
AND (IdReportModello = @pIdReportModello) AND (TpReport = @pTpReport)
ORDER BY DtCreazione DESC
END