PDC_REPORT_CreazioneDB/sql/Testbes/procedure/C6Mart_PL_GetClientNegativeCurrentAccountsValue.sql
2025-06-10 15:29:40 +02:00

27 lines
936 B
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
--[C6Mart].[PL_GetClientNegativeCurrentAccountsValue] 'F','LCNRLA67L28F520L'
CREATE procedure [C6Mart].[PL_GetClientNegativeCurrentAccountsValue]
@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)
-- Insert statements for procedure here
SELECT
--@PatrimonioBF = case when isnull(SUM(CTV),0) = 0 then 0 else SUM(CTV) end
cast( case when isnull(SUM(CTV),0) = 0 then 0 else SUM(CTV) end as decimal(15,2)) as CTV
FROM
C6Mart.PATRIMONIO_BF patrBF
WHERE
patrBF.Rete = @Rete
AND patrBF.Cod_Fiscale = @CodiceFiscale
and CTV < 0 and ID_AREA = 'CC'
--Return @PatrimonioBF
END