1FREEBCP(1) BSD General Commands Manual FREEBCP(1)
2
4 freebcp — bulk loading utility for Sybase and Microsoft databases
5
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
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
26 database
27 The name of the database containing object to be copied. Op‐
28 tional if the table/view is in the default database for username.
29
30 schema The schema of the object being copied. If not provided, the de‐
31 fault schema for username is used.
32
33 object The name of the database object you wish to access, typically a
34 table. It can also be a view. All views can be read; some can be
35 written, subject to constraints. With queryout, object can also
36 be an SQL query.
37
38 in Copy data from a host file to a database table.
39
40 out Copy data from a database table to a host file.
41
42 queryout
43 indicates that table_name is in fact SQL, rather than a database
44 object. freebcp will execute the query and write the results to
45 a file. (It is a good idea to have the query return one and only
46 one result set.)
47
48 datafile
49 The name of an operating system file.
50
52 -A packet_size
53 Set the size of a TDS packet to packet_size. Not sure why you
54 would want to do this, except as an experiment.
55
56 -D dbname
57 The name of the default database to use. Overrides default data‐
58 base associated with the login account. Causes freebcp to issue
59 a USE dbname command immediately after logging in, before com‐
60 mencing BCP operations.
61
62 -E Write the data in datafile to the table's IDENTITY column. With‐
63 out this flag, the identity data present in the datafile will be
64 ignored, and new IDENTITY values will be generated for the im‐
65 ported rows.
66
67 -F firstrow
68 The first row to copy from the input file or database table. The
69 default is the first row, row 1.
70
71 -I interfaces
72 The name and location of the interfaces file to search when con‐
73 necting to servername. Overrides freetds.conf.
74
75 -L lastrow
76 The last row to copy from an input file or database table. The
77 default is the last row.
78
79 -O options
80 SQL text to set connection options prior to the bcp operation.
81 If options is a valid filename, the SQL is read from the file in‐
82 stead. Sometimes needed for queryout. Example: -O `SET
83 QUOTED_IDENTIFIER ON'.
84
85 -P password
86 The password associated with username.
87
88 -S servername
89 The name of the Database Server to which to connect.
90
91 -T textsize
92 For text or image columns, set the maximum number of characters
93 to request from the server. Defaults to the setting in
94 freetds.conf. If not specified anywhere, defaults to the full
95 size of the data.
96
97 -U username
98 A database login name. For TDS 7+ connections, a domain login is
99 attempted if username is not provided.
100
101 -b batchsize
102 The number of rows per batch of data copied. Batching applies
103 only when you are bulk copying into the database. Each batch of
104 data is effectively “committed” into the database. The default
105 value for batchsize is 1000.
106
107 -c The host data file is (or will be) in "character" format, i.e., a
108 text file. Encoding is determined by the client charset attribute
109 in freetds.conf.
110
111 -d Turn off any logging. (Unintuitive, perhaps.)
112
113 -e errfile
114 Write errors to errfile. For uploads. Includes line and column
115 information, and the row data.
116
117 -f formatfile
118 The format of the host data file is described by formatfile. The
119 layout of formatfile is identical to that understood by the
120 Sybase and Microsoft bcp utilities, but is too complicated to de‐
121 scribe here.
122
123 -h hints
124 Set bcp hints. For valid values, cf. bcp_options() in the
125 FreeTDS Reference Manual.
126
127 -m maxerror
128 Stop after encountering maxerror errors. Default 10.
129
130 -n The host data file is in “native” format. This is a format that
131 freebcp will be able to process, but is not portable or readable.
132
133 -r row_term
134 The row terminator for a character file. May be more than one
135 character. Default is newline ('\n'). Cf. -c, above.
136
137 -t field_term
138 The field terminator for character file. Also known as a column
139 delimiter. May be more than one character. Default is tab
140 ('\t'). Cf. -c, above.
141
142 -v
143
144 -V Print the version information and exit.
145
146 -i inputfile
147 Read input data from file specified.
148
149 -o outputfile
150 Write output data to file specified.
151
152 -C charset
153 Specify character set to use to talk to server.
154
156 DSQUERY default servername
157
159 When connecting to a Sybase database server, it is required that the TDS
160 5.0 protocol be used. When connecting to a Microsoft SQL Server 2000
161 database server, the TDS 7 (or later) protocol is required.
162
163 Sybase and Microsoft define different versions of the bcp portion of TDS
164 4.2. Because FreeTDS has no way of knowing which type of server it's
165 connected to, freebcp does not support version 4.2 of the TDS protocol.
166
168 freebcp first appeared in FreeTDS 0.60
169
171 The freebcp utility was written by Bill Thompson
172 <thompbil@exchange.uk.ml.com>
173
175 Currently, there is no support for text data types in freebcp, when SQL
176 Server 2000 is the target server.
177
178FreeTDS 1.3.3 March 25, 2015 FreeTDS 1.3.3