Search code examples
azure-sql-databasebcp

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


I want to create format file (.fmt) for SQL server for bulk insert from azure blob storage. I'm using the following code:

SELECT * FROM OPENROWSET(
   BULK 'week3/inv-2017-01-19.csv',
   DATA_SOURCE = 'MyAzureInvoices',
   FORMAT = 'CSV',
   FORMATFILE='invoices.fmt',
   FORMATFILE_DATA_SOURCE = 'MyAzureInvoices'
   ) AS DataFile; 

I used this command in my cmd :

bcp [cpdb-dev].dbo.mykiosk_temp format nul -c -f C:\Users\BB-Pa\BCP\mk_data.fmt -T

But it gives an error:

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

Do I need to install bcp separately?


Solution

  • Error suggests that, you have an issue with PATH in environment variable.

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

    You can resolve above error by setting correct path in environment variable settings.

    BCP_PATH = ODI_HOME\oracledi\client\odi\bin\odi.conf should be added in environment variable settings.

    Refer - https://community.oracle.com/tech/apps-infra/discussion/4140433/bcp-is-not-recognized-on-odi-12c