I'm tryping to use BCP to transfer some data to a file. In an effort ot learn about it, I'm trying some simple stuff with the pubs database and some examples from BOL. However, none of them are working.
I'm trying this command:
bcp "SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname" queryout Authors.txt -c -Sservername -Usa -Ppassword
Of course i'm changing servername, sa, and password to the appropriate stuff..
I get the following error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'queryout'.
Any ideas why this example from BOL isn't working for me?
Thanks in advance!
MarkThat looks right. If you are doing this from within SQL (constructing a statement and executing xp_cmdshell, are you sure this is the statement being formed?|||Originally posted by bpdWork
That looks right. If you are doing this from within SQL (constructing a statement and executing xp_cmdshell, are you sure this is the statement being formed?
I'm actually using Query Analyzer and getting that error. Would that make any difference?|||Ah, yes.
BCP is a command line utility, not a SQL command. To run it from QueryAnalyser, you need to shell the command to the operating system with xp_cmdshell.
Try running it froma Command Prompt.
-b|||Originally posted by bpdWork
Ah, yes.
BCP is a command line utility, not a SQL command. To run it from QueryAnalyser, you need to shell the command to the operating system with xp_cmdshell.
Try running it froma Command Prompt.
-b
Awesome. Thanks so much.. Worked great. I feel like an idiot now.
Thanks again|||You mean, you feel smarter now.|||Originally posted by bpdWork
You mean, you feel smarter now.
Something like that. Maybe one day i'll beable to get a job as a DBA.|||DBA is boring. Programming is where it's at man! (Let the hell-fire begin!)|||DBA is boring. Programming is where it's at man! (Let the hell-fire begin!)
Am having a different kinda
discussion (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=31111) right now.
BTW ... there is a difference between a support DBA and a development DBA.
没有评论:
发表评论