declare @t table
(
id int,
SomeNumt int
)
insert into @t
select 1,10
union
select 2,12
union
select 3,3
union
select 4,15
union
select 5,23
For SQL Server 2012 onwards it could be easy:
SELECT id, SomeNumt, sum(SomeNumt) OVER (ORDER BY id) as CumSrome FROM @t
because ORDER BY
clause for SUM
by default means RANGE UNBOUNDED PRECEDING AND CURRENT ROW
for window frame ("General Remarks" at https://msdn.microsoft.com/en-us/library/ms189461.aspx)