-- Stored procedure -- ============================================= -- Author: -- Create date: -- Description: -- ============================================= --[C6MartPeriodicoImmobiliare].[PL_GetClientNegativeCurrentAccountsValue] 'S','SCLDNC71P13H224R' CREATE procedure [C6MartPeriodicoImmobiliare].[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 C6MartPeriodicoImmobiliare.PATRIMONIO_BF patrBF WHERE patrBF.Rete = @Rete AND patrBF.Cod_Fiscale = @CodiceFiscale AND ID_AREA = 'CC' and CTV < 0 --Return @PatrimonioBF END