BCP Not Working

  • Hi All,

    When I try to use bcp command on the server I usually get the below error. BCP.exe is installed too. can any one help me out. On this server I'm in a local administrator group.

    Thanks,

    Ravi

    c:\>bcp.exe

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

    [-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] [-Y]

    c:\>bcp "select * from dbname.dbo.tablename" queryout C:\Pa

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

    Syntax Error in 'queryout'.

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

    [-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] [-Y]

    c:\>bcp "select * from dbname.dbo.tablename" queryout Passw

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

    Syntax Error in 'queryout'.

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

    [-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] [-Y]

  • Do you have the Sybase bcp also installed on this machine? You may have to use the full path to bcp.exe to make sure you get the right one, or adjust the system PATH environment variable.

    What do you get if you run bcp -v?


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

  • I think sybase is installed when I run the BCP -v on the server I get the following message.

    Sybase CTBCP Utility/12.5.1 ASE Edition/ xxx /PC Intel/BUILD1251-004/xxx/Thu

    Confidential property of Sybase, Inc.

    Copyright 1987, 2003

    Sybase, Inc. All rights reserved.

    Unpublished rights reserved under U.S. copyright laws.

    This software contains confidential and trade secret information of Sybase,

    Inc. Use, duplication or disclosure of the software and documentation by

    the U.S. Government is subject to restrictions set forth in a license

    agreement between the Government and Sybase, Inc. or other written

    agreement specifying the Government's rights to use the software and any

    applicable FAR provisions, for example, FAR 52.227-19.

    Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA

  • David, can you please tell me how can I move forward with this issue.

  • he means you have to run the full path: something like this instead:...this is the path on my specific machine:

    C:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I was able to get to the path and run the bcp command and it works fine rightnow. Above he mentioned change the environmental variables and to get rid of this problem that I had first and avoid it and how can I change the environmental variables?

    Thanks,

    Ravi

  • Ravi,

    in the environment variables edit the Path and move the SQL Server paths in front of the Sybase paths. BCP will find the SQL Server version first that way.

    You need to go into the Control Panel > System > Advanced > Environment Variables

    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/

  • OK I was able to change it, but when I'm using bcp using the bcp command i'm able to get the same error. I'm unable to execute it. how can I move go ahead from here on?

  • Are you sure you're getting the right bcp? Does bcp -v still tell you it's Sybase? What happens if you use the full path name to call bcp, as suggested above? What is the exact error you get?


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

Viewing 9 posts - 1 through 8 (of 8 total)

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