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

25 lines
849 B
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
--[C6MartPeriodicoImmobiliare].[PL_GetClientSelfNegCurrentAccountValue] 'S','LMNFNC40L14L219U'
CREATE procedure [C6MartPeriodicoImmobiliare].[PL_GetClientSelfNegCurrentAccountValue]
@Rete char(1),
@CodiceFiscale varchar(16)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
--DECLARE @PatrimonioBF DECIMAL(15,2)
SELECT
cast( case when isnull(SUM(CTV),0) = 0 then 0 else SUM(CTV) end as decimal(15,2)) as CTV
FROM
C6MartPeriodicoImmobiliare.ANAG_SELF LS
WHERE
LS.rete= @Rete
AND LS.codfis= @CodiceFiscale
AND ctv < 0
--Return @PatrimonioBF
END