Home  Home  Home  Kontakt  Kontakt  Kontakt  Inhalt  Inhalt  Inhalt  Blog  Blog  Blog  FAQ  FAQ  FAQ

Tools: bcp Export/Import

bcp /?
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
  [-m maxerrors]            [-f formatfile]          [-e errfile]
  [-F firstrow]             [-L lastrow]             [-b batchsize]
  [-n native type]          [-c character type]      [-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]
  [-d database name]        [-K application intent]

Export

-- native type
bcp.exe "SELECT * FROM myDB.mySchema.myTable WHERE foo = 'bar'" queryout myDB.mySchema.myTable.bar.n.dat -S myHost\myInstance -T -m 0 -n  > bcp.queryout.myDB.mySchema.myTable.bar.log
-- character type
bcp.exe "SELECT * FROM myDB.mySchema.myTable WHERE foo = 'bar'" queryout myDB.mySchema.myTable.bar.c.txt -S myHost\myInstance -T -m 0 -c  > bcp.queryout.myDB.mySchema.myTable.bar.log