create table #aa(no int identity(1,1),AAA varchar(10),BBB int)
insert into #aa(aaa,bbb)
select aaa,bbb from table 
select AAA,BBB,(select sum(BBB) from #aa a where a.no<=no) from #aa