To prevent the log filling up you could perform an unlogged operation.
If that is not possible you could set the DB options to truncate log checkpoint during the copy procedure but this 2nd method might not be enough to ensure the log is not exhausted.
If an unlogged operation is used then after completion a full DB dump should be done to create a backup of the new baseline.
Unlogged operations might be dangerous if done outside of an offline maintenance window.
Truncate on Checkpoint (do the following and then perform a checkpoint)
To switch the Truncate mode on/off use
use master;
sp_dboption , 'trunc log on chkpt', [false|true];
To allow BCP/select INTO on a DB (do the following and then perform a checkpoint)
use master;
sp_dboption , 'select into/bulkcopy/pllsort ', [false|true];
To perform a checkpoint
To checkpoint in DB ‘dbname’ use.
use 'dbname';
checkpoint;
BCP Option
If you choose to use BCP then make sure you use fast BCP. Fast BCP is unlogged.
The rules to ensure Fast BCP is used are specified at http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc30191.1570100/doc/html/san1367605064460.html.
You can do it in two phases an ‘extract’ (out) run and then a ‘load’ in run. The commands would look something like this.
SYBASE/$SYBASE_OCS/bin/bcp ${DB1NAME}..${TABNAME} out $DUMPDIR/$DB1NAME/${TABNAME}.TXT -c -U$SQLUSER -P$USERPASS -S$SERVER1NAME
SYBASE/$SYBASE_OCS/bin/bcp ${DB1NAME}..${TABNAME} in $DUMPDIR/$DB1NAME/${TABNAME}.TXT -c -U$SQLUSER -P$USERPASS -S$SERVER1NAME
The select into / bulk copy DB option needs to be set in the DB for this to work.
You will need to dump the DB after this operation.
Unlogged Operation - Select Into
As you have access to both databases from within the same server you should have a look at using select into.
‘select into’ is an unlogged operation.
The target table for the select into statement cannot exist so what you will need to do is move the original target table using sp_rename and then run the select into using the two source tables in your query.
The select into / bulk copy DB option needs to be set for the DB for this to work.
You will need to dump the DB after this operation.
This might be slow due to the Union statement. Also union is not a good option is the rows are not unique.
Indexes
In General if there is a large index on the target table (especially a clustered one) it would probably be more efficient to drop it during the copy and recreate it afterwards.