bcp utility not working

  • Hello. We're in the process of migrating to a new data center, and we've got some of our sql servers setup and some are having issues. One issue we're having is that when trying to run a bcp command from one of our servers, it generates the following:

    Copy direction must be either 'in' or 'out'.

    Syntax Error in 'queryout'.

    usage: bcp [[database_name.]owner.]table_name[:slice_number] {in | out} datafile

    [-m maxerrors] [-f formatfile] [-e errfile]

    [-F firstrow] [-L lastrow] [-b batchsize]

    [-n] [-c] [-t field_terminator] [-r row_terminator]

    [-U username] [-P password] [-I interfaces_file] [-S server]

    [-a display_charset] [-q datafile_charset] [-z language] [-v]

    [-A packet size] [-J client character set]

    [-T text or image size] [-E] [-g id_start_value] [-N] [-X]

    [-M LabelName LabelValue] [-labeled]

    [-K keytab_file] [-R remote_server_principal]

    [-V [security_options]] [-Z security_mechanism] [-Q]

    NULL

    I've checked that bcp is installed on the server, but not sure what else I need to look for? And unfortunately, the regular DBA is currently OOTO. Any suggestions?

  • please post the actual BCP command you are running.

    ---------------------------------------------------------------------

  • bcp "SELECT top 100 * FROM instancename.dbo.tablename" queryout "\\server\folderpath\testing.txt" -c -S[server\instance] -T

  • what do you get if you run

    bcp -v

    at the command prompt on the server?


    And then again, I might be wrong ...
    David Webb

  • is sybase installed on the machine? If so, check the path, it may be finding that bcp instead of the one from SQL Server.

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • You are running Sybase's bcp.exe instead of the MS SQL Server ! Here is the output you should get for MS's bcp.exe:

    usage: D:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe {dbtable | query} {in | out | queryout | format} datafile

    [-m maxerrors] [-f formatfile] [-e errfile]

    [-F firstrow] [-L lastrow] [-b batchsize]

    [-n native type] [-c character type] [-w wide character type]

    [-N keep non-text native] [-V file format version] [-q quoted identifier]

    [-C code page specifier] [-t field terminator] [-r row terminator]

    [-i inputfile] [-o outfile] [-a packetsize]

    [-S server name] [-U username] [-P password]

    [-T trusted connection] [-v version] [-R regional enable]

    [-k keep null values] [-E keep identity values]

    [-h "load hints"] [-x generate xml format file]

    SQL = Scarcely Qualifies as a Language

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply