Search code examples
windowssql-server-2008pathbcp

How to run bcp utility from root drive?


Machine does not have full sql server installed. but following distributable packages are installed on my machine:-

  1. Microsoft® SQL Server® 2008 R2 Command Line Utilities
  2. Microsoft® SQL Server® 2008 R2 Native Client

I have a batch file that runs bcp utility. If i run this batch file from the folder where bcp.exe is sitting (...tools\binn) it works.

but my dump question is if there is any way i can run this bcp utility from c:\ drive only. Right now if it run from c:\ drive it says:-

bcp is not recognized as an internal or external command,...


Solution

  • If you add the directory (...tools\binn) to your PATH variable or use the full path of the bcp executable this will work.

    To add a directory to your PATH Control Panel > System > Advanced System Settings > Environment Variables. Then find the Path Variable under system variables and add your bcp directory to the list (seperated by ;)