t_sql_bulk_insert {sqlHelpers}R Documentation

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, ...)

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.

Value

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

Examples

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

[Package sqlHelpers version 0.1.2 Index]