bcpExport {bcputility} | R Documentation |
Export data from SQL Server
Description
A wrapper for a system call to the bcp utility which writes a SQL Server table or query (T-SQL) to a file.
Usage
bcpExport(
file,
connectargs,
table,
query,
fieldterminator = "\t",
rowterminator = ifelse(.Platform$OS.type == "windows", "\r\n", "\n"),
bcpOptions = list("-c", "-b", 1000, "-a", 4096, "-m", 10),
...
)
Arguments
file |
output file name |
connectargs |
named list of connection arguments. See makeConnectArgs. |
table |
name of the source table when exporting from SQL Server |
query |
Transact-SQL query that returns a result set. Ignored if table is specified. |
fieldterminator |
character separator for columns |
rowterminator |
character separator for rows–new lines |
bcpOptions |
list of additional options to pass to the |
... |
arguments to pass system2 |
Details
The bcpOptions
allows the user to include additional arguments for the
call to system2
. Please refer to
https://learn.microsoft.com/en-us/sql/tools/bcp-utility.
The default options are set
to the defaults for bcp
CLI. -b
refers to
number of rows to write at a time; 10,000 to 50,000 is a
starting recommendation. -a
refers to size of packets to be sent in
bytes. -e
refers to the maximum number of errors before failure.
Value
No return value. Operations from bcp are printed to console; see
...
to redirect output