[prog] SQL - "insert into"

Cynthia Kiser cnk at ugcs.caltech.edu
Fri Jun 11 09:04:06 EST 2004


My question would be "why do that" but I suspect it is for
clarity. Don't know much about ADO so I can't tell you the exact
answers. What I would look for is syntax like 

    create table "temp_table2" as 
      select "column3", "column4", ..
      from "table2"

I also don't know what the string trimming and concatenation functions
would be in ADO but something like "left trim" and "||". You can use
those as updates on temp_table2 - or could use them directly in the
select section of 

    INSERT INTO "table1" ("column1", "column2", ...)
    SELECT lefttrim("column3", 3) || 'AB2', "column4", ...
    FROM "table2"


Quoting Sue Stones <suzo at spin.net.au>:
> 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

-- 
Cynthia N. Kiser
cnk at ugcs.caltech.edu


More information about the Programming mailing list