Hi,
I have a stored procedure which when not inserted the row for date calculates correctly, but with it, the sp just takes the last enrtered value for saldo, instead of performing the calculation.  Here is the sp:
ALTER procedure [dbo].[presmetajSaldo]
(
@idki int,
@data DateTime,
@saldo numeric(12,3) output
)
as
Declare @priem numeric(12,3)            
Declare @isplata numeric(12,3)
select @priem = sum(iznosden) from blagajna_jspturs
where data=@data and vp>=0 and vp<=10
select @isplata = sum(iznosden)
from blagajna_jspturs
where vp>10 and data=@data
set @saldo = isnull(@saldo,0) + (isnull(@priem,0)) - (isnull(@isplata,0))
update Kasovizvestaj
set  
 idki=@idki,
 saldo=@saldo
 where data=@data   ---this row is the problem
select saldo from Kasovizvestaj 
return
Can anybody help me please? Thanks