The following example shows how to copy the publishers table to the PUBL_OUT file using character format:
bcp pubs..publishers out publ_out /c /Sservername /Usa /Ppassword
This is the output:
0736 |
New Moon Books |
Boston |
MA |
USA |
0877 |
Binnet & Hardley |
Washington |
DC |
USA |
1389 |
Algodata Infosystems |
Berkeley |
CA |
USA |
1622 |
Five Lakes Publishing |
Chicago |
IL |
USA |
1756 |
Ramona Publishers |
Dallas |
TX |
USA |
9901 |
GGG&G |
München |
Germany |
|
9952 |
Scootney Books |
New York |
NY |
USA |
9999 |
Lucerne Publishing |
Paris |
France |
When using character format, if you don't want to use the default terminators with the /c option, use the /t and /r options to change the terminators. The following example uses the comma as a field terminator and the newline character (\n) as the row terminator:
bcp pubs..publishers out publ_out /c /t , /r \n /Sservername /Usa /Ppassword
Here are the contents of PUBL_OUT:
0736,New Moon Books,Boston,MA,USA 0877,Binnet & Hardley,Washington,DC,USA 1389,Algodata Infosystems,Berkeley,CA,USA 1622,Five Lakes Publishing,Chicago,IL,USA 1756,Ramona Publishers,Dallas,TX,USA 9901,GGG&G,München,,Germany 9952,Scootney Books,New York,NY,USA 9999,Lucerne Publishing,Paris,,France