|
Home > Archive > SQL server exams > June 2002 > bcp Utility
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| cocolocopolo 2002-05-27, 11:28 pm |
| I use MCSE Training Kit.
The Chapter 7 talks about Managing and Manipulating Data. From page 245 down below the page, it shows:
"The following bcp command cpies data from teh Publishers table in the Pubs database and into the Publishers.txt file:
bcp pubs..publishers out publishers.txt -c -T
But I followed this way, typed inside the Editor pane and got error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '.'.
It seems I cannot type the "." in between pubs and publishers.
But if I typed in:
bcp pubs publishers out publishers.txt -c -T
I got another error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'publishers'.
What's going on ???
Also, when bulk copy out to publishers.txt, where "publishers.txt" will be located ??? Is under C:\ ??? or under SQL Server root ???
Please advise. | |
|
| quote: Originally posted by cocolocopolo
I use MCSE Training Kit.
bcp pubs..publishers out publishers.txt -c -T
But I followed this way, typed inside the Editor pane and got error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'publishers'.
Where did you type the command? I bet you typed it in Query Analyzer.
BCP is a command line utility, and so is run from the DOS prompt. If you open a dos prompt (start->Run->"cmd" on NT; start->Run->Command on Win9x) and type the command, it'll work fine.
Btw, you know what "pubs..publishers" means, right? Why there's two dots?
Cheers,
J | |
| Sturnfield 2002-06-07, 10:10 am |
| Actually you get the same error if you try to run bcp from Query Analyzer, OSQL or ISQL.
BCP is a command line utility. You can oopen a command window, or select start/run.../cmd/ok
The Microsoft MS SQL Binn directory must be in your path (and before any other db that might have a bcp) or cd to that directory.
C:\Program Files\Microsoft SQL Server\80\Tools\BINN
or
C:\Progra~1\Micros~3\80\Tools\
BINN
C:\Progra~1\Micros~3\80\Tools\
BINN>bcp pubs..publishers out publishers.txt -c -T
Starting copy...
8 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 20
Directions for BCP can be found at: http://msdn.microsoft.com/library/e...cp_bcp_61et.asp
Directions for Bulk Insert can be found at: http://msdn.microsoft.com/en-us/tsq..._ba-bz_4fec.asp | |
| cocolocopolo 2002-06-15, 1:27 am |
| Thanks J-Ho and Sturnfield.
I am sorry I tried from Query Analyzer.
It is fine from Comman Utility now.
Thanks again. |
|
|
|
|