Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    2

    Red face Unanswered: PROBLEM WITH bcp

    Hello!!

    I have a problem with bcp in Query Analyzer.
    The sentence is:

    bcp SELECT id_categoria from categorias QUERYOUT 'c:\salida.txt' -c
    -Ulogin -Ppassword

    With this sentence, the error is:
    Line 1: Incorrect syntax near 'c:\SADD.txt'.

    PLEASE, I NEED HELP.
    THANKS

  2. #2
    Join Date
    Sep 2003
    Location
    United States
    Posts
    65
    Provided Answers: 1
    this command works fine..

    bcp "SELECT * from pubs..authors" QUERYOUT "C:\salida.txt" -c -S<server name> -Usa -P<password>

    database name, server name and quotes around the query are missing from ur BCP command also the file path should be in full.
    >>
    >> Learn PHP/MySQL for free https://www.youtube.com/watch?v=mpQts3ezPVg
    >> Free Web Hosting with PHP, MySQL, Website Builder : http://www.000webhost.com/862861.html

  3. #3
    Join Date
    Oct 2003
    Location
    Ireland
    Posts
    54
    hmmm, doesn't work for me, has a problem around QUERYOUT
    strange.

    i'll keep looking

  4. #4
    Join Date
    Nov 2003
    Posts
    2
    This is true!!, the error now is:
    Line 1: Incorrect syntax near 'queryout'.


    bcp "SELECT id_categoria from categorias" queryout "C:\salida.txt" -c -S<server_name> -U<login_id> -P<password>

  5. #5
    Join Date
    Oct 2003
    Location
    Ireland
    Posts
    54
    It works via the OS command line.

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    [doooh]

    master..xp_cmdshell 'bcp "SELECT * from pubs..authors" QUERYOUT "C:\salida.txt" -c -S<server name> -Usa -P<password>'

    [/doooh]
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •