db_bcp: Write data.frame to database using bcp

Description Usage Arguments

Description

Write data.frame to database using bcp

Usage

1
2
3
4
db_bcp(data, table, conn = NULL, truncate = FALSE,
  preserve_empty_strings = TRUE, sep = "^|~", eol = "^|\r\n",
  paranoid = FALSE, preserve_memory = FALSE, tmp_dir = ".",
  tmp_keep_files = FALSE)

Arguments

data

data.frame to be written to database. Column names must match with those in the database table.

table

character string naming the table to write to. Can include database and schema name (database_name.schema_name.table_name).

conn

RODBC connection object as returned by db_connect(). Optional, but allows to re-use an already open connection to check columns and truncate table (if truncate is TRUE).

truncate

logical. If TRUE, the table will be truncated prior to writing data.

preserve_empty_strings

logical. If TRUE, empty strings in the data will be preserved by importing a dummy string and then updating the table afterwards. Otherwise empty strings will be imported as NULLs.

sep

character string to use as column separater when writing the data file passed to the bcp utility. Make sure this string does not exist in the data.

eol

character string to use as end of line separater when writing the data file passed to the bcp utility. Make sure this string does not exist in the data.

paranoid

logical. If TRUE, existing separator and EOL strings will be removed in the data. This may be a bit slow, so it's better to choose parameters sep and eol carefully.

preserve_memory

logical. If TRUE and a data.table is passed as data, the object will not be copied in memory. The original data.table may then be changed by this function.

tmp_dir

character string

tmp_keep_files

logical


itssimon/sqlservr documentation built on Aug. 6, 2021, 1:53 a.m.