bcp {dbtable | query} {in | out | queryout | format} datafile [options]
in | Imports the content of a data file into a table or view |
out | Exports the content of a table or view into a data file |
queryout | Export the data selected by a select statement. (For example something like bcp "select * from tq84_tab" queryout x -T -d tq84_db -c ). |
format | creates a format file based on the option values -n , -c , -w or -N . See also the -f option. |
-m | maxerrors | |
-f | format file | Compare with -x |
-e | errfile | |
-F | firstrow | |
-L | lastrow | |
-b | batchsize | |
-n | native type | |
-c | character type | (TODO: Warning: -c overrides -f. ) |
-w | wide character type | |
-N | keep non-text native | |
-V | file format version | |
-q | quoted identifier | |
-C | code page specifier | |
-t | field terminator | |
-r | row terminator | |
-i | inputfile | |
-o | outfile | |
-a | packetsize | |
-S | server name | |
-U | username | |
-P | password | |
-T | trusted connection | |
-v | version | |
-R | regional enable | |
-k | keep null values | |
-E | keep identity values | |
-h | "load hints" | |
-x | generate XML format file | Compare with -f |
-d | database name | |
-K | application intent | |
-l | login timeout |
C:\> bcp usage: bcp {dbtable | query} {in | out | queryout | format} datafile
bcp.exe
, otherwise, bcp will throw a Copy direction must be either 'in', 'out' or 'format'. error message, as for example with the following command line (because -d
comes too early): P:\ath\to\dir> bcp -d %DBNAME% "select * from xyz" queryout data.exe -c -T
P:\ath\to\dir> bcp "select * from xyz" queryout data.exe -c -T -d %DBNAME%
System.Data.SqlClient.SqlBulkCopy
.