Jim,

I am going add input here cautiously. 
I normally use APPEND because I ALWAYS use TEMP tables with
the exact same names as the PERMANENT table (I may add some specialty
columns for use in the TEMP table.

However there have been a couple of instances where the APPEND did not
work. I had heard that it was not a normal SQL command but a specialty
one built by R:Base so I just considered that there could sometimes be 
problems.
It is also possible that there was some sort of error that was fixed in 
later releases.
I was never able to track down why so in the cases where it does not
work I will use the INSERT ... SELECT as outlined by Razzak.

It will always work.

Jan
 


-----Original Message-----
From: "A. Razzak Memon" <[email protected]>
To: [email protected] (RBASE-L Mailing List)
Date: Fri, 13 Mar 2009 10:37:37 -0400
Subject: [RBASE-L] - Re: append table


At 10:17 AM 3/13/2009, Jim Belisle wrote:

>I have built a temporary table that will eventually be used to
>import information into a permanent table. I will be importing
>(or appending, inserting) into the temp table, info contained
>in a table created from outside info where the fields are all
>note fields. This table is already in the database. I will only
>be using certain fields to go into the temp table.  Here is the
>question.  Since I will have more fields in the temp table than
>the number of fields I will insert, what is the best method for
>doing this?


Jim,

In general, when using the APPEND command, R:BASE only copies
values from the source table or view that have matching column
names in the destination table. Columns in the destination
table that are not in the source table or view are filled with
NULL values. Rows are copied, not removed, from the source.

On the other hand, using the INSERT command, the columns taken
from the temp table can have different column names, the data
types must be the same, and the order and number of columns
in the column list of the source table (designated by SELECT)
must match the column list of the destination table (designated
by INTO).

Example:

INSERT INTO Customer (Company, CustPhone) +
SELECT cname, phone FROM temptablename WHERE ...

Last but not least, when APPENDing or INSERTing rows, all
rules and table constraints are enforced.

Very Best R:egards,

Razzak.

Reply via email to