求sql循环语句
类似这样selectA1,A2,A3fromAforeach记录inAprintA1+A2+A3next怎么在查询分析器用sql语句写出来,谢谢selectA1,A2,A...
类似这样
select A1,A2,A3 from A
for each 记录 in A
print A1+A2+A3
next
怎么在查询分析器用sql语句写出来,谢谢
select A1,A2,A3 from A
for each 记录 in A
print A1+A2+A3
select * into AAA from openrowset
('SQLOLEDB','server=xxx.xxx.xxx.xxx;uid=sa;pwd=xxx;database=B1'
, 'select * from AAA where A1=这里怎么输入循环的记录A1,谢谢') as a
INSERT INTO BBB select * from AAA
next
alex_hy大侠,表里面几十万条记录,会超时的,谢谢你。
还有我的标题就是求一条循环语句,谢谢 展开
select A1,A2,A3 from A
for each 记录 in A
print A1+A2+A3
next
怎么在查询分析器用sql语句写出来,谢谢
select A1,A2,A3 from A
for each 记录 in A
print A1+A2+A3
select * into AAA from openrowset
('SQLOLEDB','server=xxx.xxx.xxx.xxx;uid=sa;pwd=xxx;database=B1'
, 'select * from AAA where A1=这里怎么输入循环的记录A1,谢谢') as a
INSERT INTO BBB select * from AAA
next
alex_hy大侠,表里面几十万条记录,会超时的,谢谢你。
还有我的标题就是求一条循环语句,谢谢 展开
1个回答
展开全部
lz是不是不理解数据库查询的意义
select本身就是循环的过程
直接
select A1+A2+A3 from A
就行了
--------------------------
你有什么其它操作,很难有用查询写不出的事,你提出来看看
===========================
这个需要循环么?
select * into AAA from openrowset
('SQLOLEDB','server=xxx.xxx.xxx.xxx;uid=sa;pwd=xxx;database=B1'
, 'select * from AAA ')
INSERT INTO BBB select * from AAA
或者直接
INSERT INTO BBB
select * from openrowset
('SQLOLEDB','server=xxx.xxx.xxx.xxx;uid=sa;pwd=xxx;database=B1'
, 'select * from AAA ')
不就行了
需要循环么?
select本身就是循环的过程
直接
select A1+A2+A3 from A
就行了
--------------------------
你有什么其它操作,很难有用查询写不出的事,你提出来看看
===========================
这个需要循环么?
select * into AAA from openrowset
('SQLOLEDB','server=xxx.xxx.xxx.xxx;uid=sa;pwd=xxx;database=B1'
, 'select * from AAA ')
INSERT INTO BBB select * from AAA
或者直接
INSERT INTO BBB
select * from openrowset
('SQLOLEDB','server=xxx.xxx.xxx.xxx;uid=sa;pwd=xxx;database=B1'
, 'select * from AAA ')
不就行了
需要循环么?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询