Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCP not recognized?

Status
Not open for further replies.

LNBruno

Programmer
Jan 14, 2004
936
0
0
US
I'm stumped and running out of time (what's new, right?).

Any idea why I'm getting:

'bcp' is not recognized as an internal or external command,
operable program or batch file.

when I try to run:

Code:
exec master..xp_cmdshell 'bcp "SELECT * FROM DatabaseName..TableName" queryout "c:\FileName.xls" -c'


< M!ke >
 
Wow! Same situation: SQL Server reinstalled and incorrect path!

Now, how do I change it???

< M!ke >
 
according to the person

"Thanks... this indeed worked.

What I found out that due to re-installation of SQL Server, the path
'c:\program files..\binn' has been pushed to the end and it was not appearing
in the xp_cmdshell 'path'.

Once the change was made, I had to reboot the server (just merely
stopping/restarting SQL server didn't help).

It's fine now!!!"

So go to your path and move the 'c:\program files..\binn' to the beginning and restart the server

Denis The SQL Menace
SQL blog:
Personal Blog:
 
Sorry - I did read that, but I have no idea what it means. Go to my path where?

< M!ke >
 
Thank you for reading my mind! ;-)

< M!ke >
 
in system variable you will see a bunch of variables like PATH, TEMP, TMP, OS etc
copy the text (value) from PATH into notepad, move the SQl server stuff to the beginning paste it back into the value part of PATH,restart the machine and you should be fine

Denis The SQL Menace
SQL blog:
Personal Blog:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top