FREEBCP(1)
π FREEBCP(1) β like, the whole manual, but make it make sense π«Ά
okay so bestie, pull up a chair, because we're talking about freebcp β the bulk loading utility for Sybase and Microsoft databases. it's FREEBCP(1), it lives in the LOCAL section, and yes, the title line just says UNTITLED() which is very mysterious main character of it. anyway. sit down. we're doing this. β¨
πΈ SYNOPSIS πΈ
freebcp [[β¨databaseβ©.]β¨ownerβ©.]β¨object_nameβ© {in | [query]out} datafile
{-c | -n | -f formatfile} [-S servername] [-D dbname]
[-U username] [-P password] [-b batchsize] [-F firstrow]
[-L lastrow] [-e errfile] [-I interfaces] [-m maxerror]
[-t field_term] [-r row_term] [-h hints] [-T textsize]
[-A packet_size] [-O options] [-i inputfile] [-o outputfile]
[-C charset] [-EdVv]
look at all those flags. she's got range. π
π¦ DESCRIPTION π¦
freebcp is a utility program distributed with FreeTDS. the whole vibe is this: it replicates β well, in part at least β the functionality of the bcp utility programs distributed by Sybase and Microsoft. like, it's doing the same bit, just, y'know, its own way.
and how does it do it? freebcp makes use of the DB-Library bcp API provided by FreeTDS. and the tea is β that this API is also available to application developers β so it's not just for this one icon, she shares. periodt.
if you want more detail on bcp functionality in general, you can go reference the manual pages or online help for Sybase or SQL Server. they've got the lore. π
π TABLES AND FILES π
literally the cast of characters, ok:
databaseβ the name of the database containing the object to be copied. it's optional if the table/view is in the default database for username. so like, only skip it if you already know you're chilling in the right place. π«Άschemaβ the schema of the object being copied. if you don't provide it, the default schema for username is used. no schema? no problem. π«objectβ the name of the database object you wish to access β typically a table. it can also be a view. all views can be read, and some can be written, subject to constraints (so, y'know, view check that vibe first). withqueryout, object can also be an SQL query. iconic, honestly.inβ copy data from a host file to a database table. uploading. β¬οΈoutβ copy data from a database table to a host file. downloading. β¬οΈqueryoutβ this one indicates that table_name is in fact SQL, rather than a database object.freebcpwill execute the query and write the results to a file. π quick heads up though: it is a good idea to have the query return one and only one result set. like, one. singular. don't be greedy.datafileβ the name of an operating system file. that's the file, bestie. π
β¨ OPTIONS β¨
grab a snack, this is the long part. π
-Apacket_size β set the size of a TDS packet to packet_size. and, ngl, the manpage itself says it's not sure why you would want to do this, except as an experiment. so likeβ¦ go off? π-Ddbname β the name of the default database to use. it overrides the default database associated with the login account. what it actually does is causefreebcpto issue aUSE dbnamecommand immediately after logging in, before commencing BCP operations. so it's a pre-game move. π¬-Eβ write the data in datafile to the table'sIDENTITYcolumn. without this flag, the identity data present in the datafile will be ignored, and newIDENTITYvalues will be generated for the imported rows. so if you don't pass-E, your precious identity values get replaced. rude, but true. π-Ffirstrow β the first row to copy from the input file or database table. default is the first row, row1. one. the beginning. β-Iinterfaces β the name and location of the interfaces file to search when connecting to servername. it overridesfreetds.conf. ποΈ-Llastrow β the last row to copy from an input file or database table. default is the last row. the actual end. π-Ooptions β SQL text to set connection options prior to the bcp operation. and here's the cute part: if options is a valid filename, the SQL is read from the file instead. sometimes needed forqueryout. example time:
-O `SET QUOTED_IDENTIFIER ON'
-Ppassword β the password associated with username. π-Sservername β the name of the Database Server to which to connect. π-Ttextsize β fortextorimagecolumns, set the maximum number of characters to request from the server. it defaults to the setting infreetds.conf. if it's not specified anywhere, it defaults to the full size of the data. so, like, either you say it, or the config says it, or it just sends everything. π-Uusername β a database login name. and for TDS 7+ connections, a domain login is attempted if username is not provided. πͺͺ-bbatchsize β the number of rows per batch of data copied. batching applies only when you are bulk copying into the database. each batch of data is effectively βcommittedβ into the database. the default value for batchsize is1000. one thousand little rows per batch, slay. π-cβ the host data file is (or will be) in "character" format, i.e., a text file. encoding is determined by the client charset attribute infreetds.conf. π¦-dβ turn off any logging. and yes, the manpage says it's unintuitive, perhaps β because-dfor "turn off logging" is a whole choice. but that's the choice that was made. π-eerrfile β write errors to errfile. for uploads. includes line and column information, and the row data. very thorough of her. π-fformatfile β the format of the host data file is described by formatfile. the layout of formatfile is identical to that understood by the Sybase and Microsoftbcputilities β but it is too complicated to describe here. so, like, not in this manpage. sorry bestie. π-hhints β set bcp hints. for valid values, cf.bcp_options()in the FreeTDS Reference Manual. look it up, iykyk. π-mmaxerror β stop after encountering maxerror errors. default10. ten strikes and you're out. β οΈ-nβ the host data file is in βnativeβ format. this is a format thatfreebcpwill be able to process, but is not portable or readable. so it works for her and basically nobody else. π-rrow_term β the row terminator for a character file. may be more than one character. default is newline ('\n'). cf.-c, above. π§-tfield_term β the field terminator for character file. also known as a column delimiter. may be more than one character. default is tab ('\t'). cf.-c, above. π-vβ the original page lists this flag with literally nothing next to it. no description. just vibes. π«₯-Vβ print the version information and exit. short and iconic. β-iinputfile β read input data from file specified. π₯-ooutputfile β write output data to file specified. π€-Ccharset β specify character set to use to talk to server. π£οΈ
π ENVIRONMENT π
DSQUERYβ default servername. that's it. that's the whole section. π
π₯ NOTES π₯
real talk, two big ones:
when connecting to a Sybase database server, it is required that the TDS 5.0 protocol be used. when connecting to a Microsoft SQL Server 2000 database server, the TDS 7 (or later) protocol is required. no substitutions, bestie. π¨
and also:
Sybase and Microsoft define different versions of the bcp portion of TDS 4.2. and because FreeTDS has no way of knowing which type of server it's connected to, freebcp does not support version 4.2 of the TDS protocol. so if that's your plan β it's not. periodt. π
π°οΈ HISTORY π°οΈ
freebcp first appeared in FreeTDS 0.60. a legend from the jump. π
π«Ά AUTHORS π«Ά
the freebcp utility was written by Bill Thompson <thompbil@exchange.uk.ml.com>. thank you bill, we appreciate you. πΈ
π BUGS π
currently, there is no support for text data types in freebcp when SQL Server 2000 is the target server. so if that's the mission β adjust the mission. π
okay that's the whole thing, you made it, I'm so proud π₯Ή this page is from FreeTDS 1.5.20, dated March 25, 2015 β so like, she's vintage, she's FREEBCP(1), she's in LOCAL, and she ate. go bulk load something, bestie. ππβ¨
π¦ where this page comes from
- arch rolling: freetds 1.5.20-1 Β· GPL-2.0-only AND LGPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms