2012年2月25日星期六

BCP bcp is not recognized

Hi
I am a bit new to SQL Server so please help me
I am trying to run a simple task at a customer but it doesn't work.
bcp isn't recognized.

I'm running this:
exec xp_cmdshell 'bcp "SELECT top 10 * FROM pubs..authors " queryout "C:\Temp\hej.txt" -c -S [ServerName] -T'
and it givs me this errormess.
'bcp' is not recognized as an internal or external command,

It works fine for me when I'm running it on my computer.

Can anyone please inform me what I'm missing. I haven't got a clue.
BR
CiottiIs the folder where bcp.exe is in your path (system) ?|||Hai ciotti,

Where is the "hej.txt" file located ? In the server hard disk or in the client machine hard disk.

When u use xp_cmdshell extended stored procdure, the command will be executed in the server and not in the client machine.

You have said that it works fine in ur system. So did u executed 'bcp' from the command line or using xp_cmdshell ?

If ur machine is the server and u executed it in the command prompt, then fine, u have to include the path of "bcp" in the System PATH.

Hope this helps u...Do let us know what happened.|||You were right. Someone had messed up the system path.
(Don't know who, and I dont care ;) )

Now the bcp command works.
The customer is happy and that makes me happy.
Thank you all for your quick answers.

/Ciotti

没有评论:

发表评论