仅插入和FETCH第一行 [英] Insert into and FETCH FIRST ROW ONLY

查看:121
本文介绍了仅插入和FETCH第一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试插入一个临时表,但只插入第一个n

行数。我以为我可以使用插入到
和fect第一行命令的组合,但它不会工作。有谁知道为什么?


除了写一个循环之外的任何其他建议?这是从另一个db2 sql存储过程调用的db2 sql

存储过程。

解决方案

" dataguy" < ba ********* @ progressive.comwrote in message

news:11 ********************* *@j72g2000cwa.googlegr oups.com ...


>我试图插入临时表但只有第一个n

行数。我以为我可以使用插入到
和fect第一行命令的组合,但它不会工作。有谁知道为什么?


除了写一个循环之外的任何其他建议?这是从另一个db2 sql存储过程调用的db2 sql

存储过程。



如果您发布SQL,那么也许有人可以帮助您。


dataguy写道:


我试图插入一个临时表但只有第一个n

行数。我以为我可以使用插入到
和fect第一行命令的组合,但它不会工作。有谁知道为什么?


除了写一个循环之外的任何其他建议?这是从另一个db2 sql存储过程调用的db2 sql

存储过程。



这是你要找的?

INSERT INTO SESSION.TEMP SELECT * from T FETCH FIRST 10行只有


干杯

Serge


-

Serge Rielau

DB2解决方案开发

IBM多伦多实验室


WAIUG会议
http:// www。 iiug.org/waiug/present/Fo...Forum2006.html


当我们尝试发布类似于下面的语句时,我们

一直抱怨抱怨抓取。当我们删除

仅获取第一个xx行时并尝试过,没问题。如果你愿意,我可以发布

sql。

Serge Rielau写道:


dataguy写道:


我试图插入一个临时表但只有第一个n

行数。我以为我可以使用插入到
和fect第一行命令的组合,但它不会工作。有谁知道为什么?


除了写一个循环之外的任何其他建议?这是从另一个db2 sql存储过程调用的db2 sql

存储过程。



这就是你要找的东西吗?

INSERT INTO SESSION.TEMP SELECT *来自T FETCH FIRST 10行只有


干杯

Serge


-

Serge Rielau

DB2解决方案开发

IBM多伦多实验室


WAIUG会议
http://www.iiug.org/waiug/present/Fo...Forum2006.html


I am trying to insert into a temporary table but only the first n
number of rows. I thought I could use the combination of insert into
and fect first row command ,but it won''t work. Does anyone know why?

Any other suggestions other than writing a loop? This is in a db2 sql
stored procedure that is called from another db2 sql stored proc.

解决方案

"dataguy" <ba*********@progressive.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...

>I am trying to insert into a temporary table but only the first n
number of rows. I thought I could use the combination of insert into
and fect first row command ,but it won''t work. Does anyone know why?

Any other suggestions other than writing a loop? This is in a db2 sql
stored procedure that is called from another db2 sql stored proc.

If you post the SQL, then maybe someone will be able to help you.


dataguy wrote:

I am trying to insert into a temporary table but only the first n
number of rows. I thought I could use the combination of insert into
and fect first row command ,but it won''t work. Does anyone know why?

Any other suggestions other than writing a loop? This is in a db2 sql
stored procedure that is called from another db2 sql stored proc.

Is this what you are looking for?
INSERT INTO SESSION.TEMP SELECT * FROM T FETCH FIRST 10 ROWS ONLY

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html


When we tried to issue the statement similar to what you have below, we
kept getting an error complaining about the fetch. When we removed the
"fetch first xx rows only" and tried it, no problem.. I can post the
sql if you want it.
Serge Rielau wrote:

dataguy wrote:

I am trying to insert into a temporary table but only the first n
number of rows. I thought I could use the combination of insert into
and fect first row command ,but it won''t work. Does anyone know why?

Any other suggestions other than writing a loop? This is in a db2 sql
stored procedure that is called from another db2 sql stored proc.

Is this what you are looking for?
INSERT INTO SESSION.TEMP SELECT * FROM T FETCH FIRST 10 ROWS ONLY

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html


这篇关于仅插入和FETCH第一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆