At 02:30 PM 8/19/2015, Dan Goldberg wrote:

I want to copy data from one table into another table. The problem is
I have one column in the destination that is an autonumber field.

I want to put the number from the source table in that autonumber field
as I have already captured it using the nextnum function.

Other than using unload/load does anybody know a way to achieve this?


Dan,

There are many techniques to achieve your goal to APPEND data from
one table to another with AUTONUM column.

Here's a very simple technique ...

Steps:

01. Before attempting to APPEND data from one table to another table,
    use the following command for the "Target" table:

    AUTONUM ColumnName IN TargetTable DELETE

02. Now APPEND the data from source table to target table

    APPEND SourceTable TO TargetTable

03. Re-Assign the AutoNum for column in TargetTable

    SET VAR vMaxValue INTEGER = 0
    SELECT (MAX(ColumnName)) INTO vMaxValue INDIC iv1 FROM TargetTable
    AUTONUM ColumnName IN TargetTable USING .vMaxVallue 1 NUM
    CLEAR VARIABLES iv1,vMaxValue
    RETURN

Hope that helps!

Feel free to reach out to me with any questions.

Very Best R:egards,

Razzak.

www.rbase.com
www.rbaseX.com
www.facebook.com/rbase
--
32 years of continuous innovation!
17 Years of R:BASE Technologies, Inc. making R:BASE what it is today!
--


Reply via email to