Re: Why there is RENAME TABLE but no COPY TABLE?
Posted in 2000
Hi, all
Is a script like this good enough to transfer, say 3GB of data (9
columns of ints and some chars) in a "reasonable" amount of time, or is
there a more efficient way to do this? (And if so, how much more
efficient?)
Thanks again!
Duff
>
> Here is a nice copy table script:
>
> #! /usr/bin/ksh
>
> if [[$# -eq 0]]; then
> echo "Usage: copytable <database> <oldtabname> <newtabname>
<Y/N>
> database=$1
> oldname=$2
> newname=$3
> data=$4
>
> dbschema -d $database -t oldname | sed \\ "s/$oldname/$newname/" | \\
> dbaccess database ->
> if [[$data == "y" || $data == "Y"]]; then
> dbaccess database - <<EOF!
> BEGIN WORK;
> insert into $newname
> select * from $oldname;> COMMIT WORK;
> EOF!
>
> ################### end of script #########################
>
> Keep in mind that because Informix delivers lots of neat tools like
dbschema> you can usually create anything you feel is missing.
>
> Art S. Kagel
>
Sent via Deja.com http://www.deja.com/
Before you buy.