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_jspturswhere data=@data and vp>=0 and vp<=10
select @isplata = sum(iznosden)from blagajna_jspturswhere 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