Search code examples
sql-serverazurebcpsql-server-2014

BCP utility incorrect syntax


What is incorrect about this syntax?

bcp transitschedule in calendar_dates.txt -T -f calenar_dates.fmt -F 2

I have tried this through sqlcmd and SSMS to a database on Azure. When I run the command I get:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'in'.

Yet, the examples here are not very much different syntactically. If I add database name or schema name error shifts towards the period.


Solution

  • Like SQLCMD, BCP is a stand-alone command-prompt utility that must be invoked from a command prompt. If the source text and format files reside on your client, you'll need to add the -S -U and -P parameters like you do with SQLCMD. For example:

    bcp databasename.schemaname.transitschedule in calendar_dates.txt -f calenar_dates.fmt -F 2 /S azure-database-server /U azure-database_login /P azure-database-password