Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple insert 1

Status
Not open for further replies.

Thorsten3

Programmer
Jan 28, 2001
22
JP
I would like to insert more rows into the table t_str_dag
using the following select command, but I always get this "specifies multiple columns"- Error
even though the select command alone gives me exactly what I want to insert.???


db2 => select id, id/100 *100 from t_structures where id>200 and id <300

ID 2
----------- -----------
220 200
230 200
240 200

3 record(s) selected.

db2 => insert into t_str_dag (str_id, parent_id) values(select id, id/100 *100 from t_structures where id>200 and id <300)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0412N The SELECT clause of a subquery specifies multiple columns.
SQLSTATE=42823
 
Thorsten:

Use this syntax:

insert into t_str_dag (str_id, parent_id)
select id, (id/100 *100)
from t_structures
where id>200 and id <300

Does this work?


T. Blom
Information analist
Shimano Europe
tbl@shimano-eu.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top