PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Robert_Gorrebeeck at concentra dot com
Subject: Syntax example of an Inset statement where it is selecting values from another table
Date: Mar 22 2006 3:05PM

All

I am wondering if anyone has an example of an Inset statement where it is 
selecting values from another table. 

So for example in sql or a stored proc it would look like this

        Insert into table a (column1,
                         column2,
                         column3,
                         column4
        select( column1,
                        column2,
                column3
                column4
        from table b 

But am not sure of the syntax when using DBI
I know when I want to insert a row I can do this, but am not sure of the 
syntax when I want to grab a bunch of rows from one table and insert them 
into another.

$sth=$dbh->prepare(qq{INSERT INTO table b(column1, column2, column3, column4) VALUES (?, ?, ?, ?)}); 

I guess one solution is to loop thru the rows that I get returned via a 
select statement but that seems like a waste of processing time

Any help would be appreciated

Robert Gorrebeeck
Concentra Online Services
972.725.6956
Robert_Gorrebeeck@concentra.com
****** CONFIDENTIALITY NOTICE ******
NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message from your system. Thank you.