Learn R Programming

sqlHelpers (version 0.1.2)

t_sql_bulk_insert: Generate a BULK INSERT statement, optionally execute the statement if con is not NULL.

Description

Generate a BULK INSERT statement, optionally execute the statement if con is not NULL.

Usage

t_sql_bulk_insert(file, schema = NULL, table, con = NULL, ...)

Value

A string, the BULK INSERT statement; or the results retrieved by DBI::dbGetQuery after executing the statement.

Arguments

file

A string, the file path to the file with data to insert.

schema

A string, the schema name of the destination SQL table.

table

A string, the table name of the destination SQL table.

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

...

named arguments are passed to the WITH statement.

Examples

Run this code
t_sql_bulk_insert(
file = tempfile(),
schema = "test",
table = "table1",
format = 'CSV',
first_row = 2,
)

Run the code above in your browser using DataLab