问一个数学问题,如何用程序实现? 要求变量A以下列形式变化:0,110,230,360,500,650......谢谢赐教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 --len=100select top 100 id=identity(int,110,10)into #tfrom syscolumns a,syscolumns bselect [a]=0union allselect [a]=(select sum(id) from #t where id<=t.id)from #t tdrop table #t/*a ----------- 011023036050065081098011601350155017601980221024502700296032303510380041004410473050605400575061106480686072507650806084808910935098001026010730112101170012200127101323013760143001485015410159801656017150177501836018980196102025020900215602223022910236002430025010257302646027200279502871029480302603105031850326603348034310351503600036860377303861039500404004131042230431604410045050460104698047960489504995050960519805301054050551005616057230583105940060500*/ declare @i int,@num int,@tem intset @i = 0set @num = 0while(@i<10)begin if @i = 0 print '0' else begin set @tem = @i *10 + 100 set @num = @num + @tem print '@num='+cast(@num as varchar(20)) end set @i = @i + 1end 新手的疑惑:一个想问又不敢问的问题 SQL2000将查询结果导入 请教一个问题,在线等! 请索引高手解答疑惑 循环查询问题 用SQL语句导出数据,但导出没有列名,请问各位高手如果导出数据的同时导出表的列名? sql2005数据库修改问题 请教这个稍微复杂的sql该怎么写。谢谢指教 防止数据库被移植后再用-----请尝试!我没写出来 一条sql查询语句真难 求一简单SQL,急,在线等! 怎样知道写xml用的是什么字符集 着急!
into #t
from syscolumns a,syscolumns b
select [a]=0
union all
select [a]=(select sum(id) from #t where id<=t.id)
from #t tdrop table #t/*
a
-----------
0
110
230
360
500
650
810
980
1160
1350
1550
1760
1980
2210
2450
2700
2960
3230
3510
3800
4100
4410
4730
5060
5400
5750
6110
6480
6860
7250
7650
8060
8480
8910
9350
9800
10260
10730
11210
11700
12200
12710
13230
13760
14300
14850
15410
15980
16560
17150
17750
18360
18980
19610
20250
20900
21560
22230
22910
23600
24300
25010
25730
26460
27200
27950
28710
29480
30260
31050
31850
32660
33480
34310
35150
36000
36860
37730
38610
39500
40400
41310
42230
43160
44100
45050
46010
46980
47960
48950
49950
50960
51980
53010
54050
55100
56160
57230
58310
59400
60500
*/
set @i = 0
set @num = 0
while(@i<10)
begin if @i = 0
print '0'
else
begin
set @tem = @i *10 + 100
set @num = @num + @tem
print '@num='+cast(@num as varchar(20))
end
set @i = @i + 1
end