[prog] SQL - "insert into"
Tricia Bowen
sendtotricia at yahoo.com
Fri Jun 11 09:31:32 EST 2004
To do the following: "But can I put the information into some other data table to make the changes to the name and then insert it into a table."
Try:
create table foo as select name from yourtable where name like 'AB1_%';
update foo set name='AB2' || (substr(name,2,length(name))) where name like 'AB1%';
insert into table1(column1) select name as column1 from foo;
Fyi, this is for oracle, you might have to tweak for your db.
--Tricia
Sue Stones <suzo at spin.net.au> wrote:
I am trying to sort out a database problem on a system using Visual
basic and ADO.net (which is driving me up the wall). That part aside, I
am trying to insert some information into some tables. What I want to
do is select a whole lot of rows with the name attribute
AB1_somthingOrOther, change the name to AB2_somthingOrOther and inset
the whole lot back into the relevant tables.
I know that I can do something like
INSERT INTO "table1" ("column1", "column2", ...)
SELECT "column3", "column4", ...
FROM "table2"
to insert multiple rows at once. But can I put the information into
some other data table to make the changes to the name and then insert it
into a table.
In other words are there less direct ways of inserting multiple rows in
to tables with SQL.
sue
_______________________________________________
Programming mailing list
Programming at linuxchix.org
http://mailman.linuxchix.org/mailman/listinfo/programming
Tricia Bowen
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
More information about the Programming
mailing list