1FREEBCP(1)                BSD General Commands Manual               FREEBCP(1)
2

NAME

4     freebcp — bulk loading utility for Sybase and Microsoft databases
5

SYNOPSIS

7     freebcp [[⟨database⟩.]⟨owner⟩.]⟨object_name⟩ {in | [query]out} datafile
8             {-c | -n | -f formatfile} [-S servername] [-D dbname]
9             [-U username] [-P password] [-b batchsize] [-F firstrow]
10             [-L lastrow] [-e errfile] [-I interfaces] [-m maxerror]
11             [-t field_term] [-r row_term] [-h hints] [-T textsize]
12             [-A packet_size] [-O options] [-i inputfile] [-o outputfile]
13             [-C charset] [-EdVv]
14

DESCRIPTION

16     freebcp is a utility program distributed with FreeTDS.  freebcp repli‐
17     cates (in part at least) the functionality of the bcp utility programs
18     distributed by Sybase and Microsoft.  freebcp makes use of the DB-Library
19     bcp API provided by FreeTDS. This API is also available to application
20     developers.
21
22     The manual pages or online help for Sybase or SQL Server can be refer‐
23     enced for more detailed information on bcp functionality.
24

TABLES AND FILES

26     database
27             The name of the database containing object to be copied.
28             Optional if the table/view is in the default database for
29             username.
30
31     schema  The schema of the object being copied. If not provided, the
32             default schema for username is used.
33
34     object  The name of the database object you wish to access, typically a
35             table. It can also be a view.  All views can be read; some can be
36             written, subject to constraints.  With queryout, object can also
37             be an SQL query.
38
39     in      Copy data from a host file to a database table.
40
41     out     Copy data from a database table to a host file.
42
43     queryout
44             indicates that table_name is in fact SQL, rather than a database
45             object.  freebcp will execute the query and write the results to
46             a file. (It is a good idea to have the query return one and only
47             one result set.)
48
49     datafile
50             The name of an operating system file.
51

OPTIONS

53     -A packet_size
54             Set the size of a TDS packet to packet_size.  Not sure why you
55             would want to do this, except as an experiment.
56
57     -D dbname
58             The name of the default database to use.  Overrides default data‐
59             base associated with the login account.  Causes freebcp to issue
60             a USE dbname command immediately after logging in, before com‐
61             mencing BCP operations.
62
63     -E      Write the data in datafile to the table's IDENTITY column. With‐
64             out this flag, the identity data present in the datafile will be
65             ignored, and new IDENTITY values will be generated for the
66             imported rows.
67
68     -F firstrow
69             The first row to copy from the input file or database table. The
70             default is the first row, row 1.
71
72     -I interfaces
73             The name and location of the interfaces file to search when con‐
74             necting to servername. Overrides freetds.conf.
75
76     -L lastrow
77             The last row to copy from an input file  or database table. The
78             default is the last row.
79
80     -O options
81             SQL text to set connection options prior to the bcp operation.
82             If options is a valid filename, the SQL is read from the file
83             instead. Sometimes needed for queryout.  Example: -O `SET
84             QUOTED_IDENTIFIER ON'.
85
86     -P password
87             The password associated with username.
88
89     -S servername
90             The name of the Database Server to which to connect.
91
92     -T textsize
93             For text or image columns, set the maximum number of characters
94             to request from the server. Defaults to the setting in
95             freetds.conf.  If not specified anywhere, defaults to the full
96             size of the data.
97
98     -U username
99             A database login name.  For TDS 7+ connections, a domain login is
100             attempted if username is not provided.
101
102     -b batchsize
103             The number of rows per batch of data copied. Batching applies
104             only when you are bulk copying into the database. Each batch of
105             data is effectively “committed” into the database. The default
106             value for batchsize is 1000.
107
108     -c      The host data file is (or will be) in "character" format, i.e., a
109             text file. Encoding is determined by the client charset attribute
110             in freetds.conf.
111
112     -d      Turn off any logging. (Unintuitive, perhaps.)
113
114     -e errfile
115             Write errors to errfile.  For uploads.  Includes line and column
116             information, and the row data.
117
118     -f formatfile
119             The format of the host data file is described by formatfile.  The
120             layout of formatfile is identical to that understood by the
121             Sybase and Microsoft bcp utilities, but is too complicated to
122             describe here.
123
124     -h hints
125             Set bcp hints. For valid values, cf.  bcp_options() in the
126             FreeTDS Reference Manual.
127
128     -m maxerror
129             Stop after encountering maxerror errors. Default 10.
130
131     -n      The host data file is in “native” format.  This is a format that
132             freebcp will be able to process, but is not portable or readable.
133
134     -r row_term
135             The row terminator for a character file.  May be more than one
136             character.  Default is newline ('\n'). Cf.  -c, above.
137
138     -t field_term
139             The field terminator for character file. Also known as a column
140             delimiter. May be more than one character.  Default is tab
141             ('\t'). Cf.  -c, above.
142
143     -v
144
145     -V      Print the version information and exit.
146
147     -i inputfile
148             Read input data from file specified.
149
150     -o outputfile
151             Write output data to file specified.
152
153     -C charset
154             Specify character set to use to talk to server.
155

ENVIRONMENT

157     DSQUERY default servername
158

NOTES

160     When connecting to a Sybase database server, it is required that the TDS
161     5.0 protocol be used. When connecting to a Microsoft SQL Server 2000
162     database server, the TDS 7 (or later) protocol is required.
163
164     Sybase and Microsoft define different versions of the bcp portion of TDS
165     4.2.  Because FreeTDS has no way of knowing which type of server it's
166     connected to, freebcp does not support version 4.2 of the TDS protocol.
167

HISTORY

169     freebcp first appeared in FreeTDS 0.60
170

AUTHORS

172     The freebcp utility was written by Bill Thompson
173     <thompbil@exchange.uk.ml.com>
174

BUGS

176     Currently, there is no support for text data types in freebcp, when SQL
177     Server 2000 is the target server.
178
179FreeTDS 1.1.20                  March 25, 2015                  FreeTDS 1.1.20
Impressum