PDC_REPORT_CreazioneDB/sql/storedCollaudo/C6Mart_PL_D2_S156ALtroPatrimonio.sql
2025-06-09 17:09:11 +02:00

25 lines
784 B
SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE procedure [C6Mart].[PL_D2_S156ALtroPatrimonio]
-- Add the parameters for the stored procedure here
@Rete char(1),
@CodiceFiscale varchar(16)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
SELECT
PATRIMONIO_ALTRO.DESCRIZIONE AS Denominazione,
PATRIMONIO_ALTRO.QUANTITA AS NumeroQuote,
PATRIMONIO_ALTRO.CTV AS Valore,
SUM(PATRIMONIO_ALTRO.CTV) OVER (PARTITION BY 'Totale') as Totale
FROM
C6MART.PATRIMONIO_ALTRO
WHERE
PATRIMONIO_ALTRO.RETE = @Rete
AND PATRIMONIO_ALTRO.COD_FISCALE = @CodiceFiscale
ORDER BY
PATRIMONIO_ALTRO.CTV DESC
END