-- Schema: C6Mart -- Stored Procedure: PL_GetClientNegativeCurrentAccountsValue -- ============================================= -- Author: -- Create date: -- 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