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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating an insert statement

Status
Not open for further replies.

jjlbmcnews

IS-IT--Management
Oct 4, 2001
60
0
0
GB
I need to generate a number of insert statements using the results of a select statement. Basically I have the following statement -

insert into table1
select table1.column1, value1
from table1
where table1.column2=value2
and table1.column1 not in (select table1.column1
from table1 where table1.column2=value1)

The above query works fine if I manually specify value1 and value2 but I need this to generate the values automatically as I need to do this for several hundred values!
 
do it with stored procedures...

separate each logical unit and put each in a SP..

that way you can call one from within another and send it parameters.....
a bit rusty on HOW exactly to do it... but if you see what i mean.........

Aftertaf

"Solutions are not the answer." - Richard Nixon
 
Ah, did I mention that this was in Oracle?
 
No, but you should have done! This is a SQL Server forum - you need to post this question in an Oracle forum.

--James
 
loooool
never mind


Aftertaf

"Solutions are not the answer." - Richard Nixon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top