how to run bcp

  • Hi, I run a bcp command inside my sql analyzer.

    I did this:

    master.dbo.xp_cmdshell "bcp dbname.dbowner.category out c:\MYBCP.fil -Usa -Ppassword -c"

    It generates this error:

    SQLState = 08001, NativeError = 17

    Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.

    SQLState = 01000, NativeError = 2

    Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Connect()).

    NULL

    what did I do run?

    Thanks in advance.

  • Hi, I used wrong servername and that's why it failed. Now I get the command executed, but has a new question:

    I execute the xp_cmdshell 'bcp ...' command in

    sql server client machine's query analyze, where the bcp file should go, the client machine where I made the call to bcp, or the server machine, where the sql server is running?

    I can't find the output file on the client machine.

    Thanks in advance.

  • When you do xp_cmdshell it shells out to the server you are attached to and the file will be exported there. You have to open a CMD prompt on you machine and do the BCP command line to export to your local machine.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • I tried at client machine using cmd prompt, it works. Thank you very much.

Viewing 4 posts - 1 through 3 (of 3 total)

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