A wrapper for a system call to the bcp utility which writes a SQL Server table or query (T-SQL) to a file.
output file name
the instance of SQL Server to which to connect
Specifies the database to connect to
name of the source table when exporting from SQL Server
Transact-SQL query that returns a result set. Ignored if table is specified.
use integrated security, username and password are not required
login ID
password for login ID
character separator for columns
character separator for rows--new lines
the format of datatypes, char performs the operation using a character data type, nchar performs the bulk copy operation using Unicode characters
arguments to pass system2
No return value. Operations from bcp are printed to console; see
...
to redirect output
if (FALSE) {
bcpExport('myfile.tsv',
server = server,
database = database,
table = 'mytable',
fieldterminator = '|',
stdout = FALSE,
datatypes = 'char')
}