[freetds] patch for new application program
Thompson, Bill D (London)
bill_d_thompson at ml.com
Mon Nov 15 11:58:24 EST 2004
I posted a patch to source forge last week.
This patch includes a new application program - datacopy - which a
couple of people have expressed an interest in recently.
This program allows the user to move a table of data from one server to
another without the need for bcp-ing the data out and in.
In so doing, it bypasses the need for intermediate data files, and is
also faster, as it bypasses the need to convert data to and from
I have used the program extensively to migrate data from Sybase to SQL
server, and vice versa, but it could have a variety of uses.
I needed to make a few small changes to db-library to allow this program
A couple were small and (probably undetected) bugs in existing functions
- dbcolinfo() primarily - but I also added a new dblibrary function -
dbtablecolinfo() - to allow me to accurately describe a table without
resorting to accessing TDS layer data.
I have also included a manual page, as follows:
datacopy - move table data between two servers
datacopy [-t | -a | -c owner] [-b batchsize] [-p packetsize] [-v] [-d]
datacopy is a utility program distributed with FreeTDS.
datacopy will move table data from one server to another, without
the need for intermediate files. Using datacopy will be much faster
and more efficient than using freebcp out/in.
datacopy makes use of the dblib bcp api built into FreeTDS. This
api is also available to application developers.
datacopy can be used to migrate data between Sybase ASE and SQL Server
or vice versa.
-t truncate target table before loading data
-a append data to target table
-c owner create the target table with the same schema as the
table. datacopy will submit a 'create table' command on
the target server/database using the specified owner in
the command, e.g. create table owner.table (...
-b batchsize is the number of rows per batch of data copied.
Each batch of data is effectively 'committed'
into the database. the default value for batchsize is
-p packetsize Specifies the number of bytes, per network packet, sent
and from the server(s). Increased packet size can
-v produce verbose output, including diagnostic timings.
-d produce freetds TDSDUMP output (serious debug only!)
-S ... specifies the connection information for the source
and the location/name of the table (or view) to be
The argument to the -S option is in the format:
If the -S option is not specified, datacopy will prompt
user to enter this data.
-D ... specifies the connection information for the destination
and the location/name of the target table.
The argument to the -D option is in the format:
If the -D option is not specified, datacopy will prompt
user to enter this data.
datacopy first appeared in FreeTDS 0\.63
The datacopy utility was written by Bill Thompson
(thompbil at exchange.uk.ml.com)
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/
More information about the FreeTDS