Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Angry Unanswered: CSV export via BCP, spaces in database name >:(

    Hello, I'm having trouble with an SQL database that has a space in it's name. What I want to do is extract the table "fileinfo" from the database "Vigilant Server" to a CSV file "FileInfo.CSV". Also, know that I am neither a programmer nor a DB admin, merely a general technician and a writer of DOS BAT files.

    First I tried using OSQL:
    Code:
    OSQL -U xxx -P xxx -d "Vigilant Server" -Q "SELECT * FROM fileinfo" -o FileInfo.CSV
    It works but is incredibly slow.

    Then I heard about BCP, and tried this:
    Code:
    BCP "Vigilant Server..fileinfo" out FileInfo.CSV -U xxx -P xxx -c -t ,
    No matter where I put the quotation marks, I can't get BCP to recognize Vigilant Server as the database name.

    I am not doing something right? Is there another way to do this that's better suited to what I'm trying to do? Any help would be appreciated.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Check out the books online (bol) for the bcp command:

    To specify a database name that contains a space or quotation mark, you must use the q option.

  3. #3
    Join Date
    Nov 2002
    Posts
    2
    That worked just great, thank you for your help.

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    You are welcome. The bol tool will be an invaluable resource for you.

Posting Permissions

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