Creating a bcp format file

  • Good morning-

    I'm trying to create a non-XML (character) format file for import. Here is the command I'm running from the command line:

    c:\bcp "data_base.dbo.table" format nul -c -f filename.fmt -S"server\instance" -T

    I'm getting "Syntax error in 'format'

    Anyone able to help? I've checked BOL and Google but I'm still running into problems. I've checked with our DBAs and they tell me remote connections are enabled. We use Windows authentication.

    Thanks in advance...

    Jason

  • 1. I don't think that you need to use the double-quotes around the 3-part db.schema.object unless it contains a space or quotation mark; then you would also need to use the -q flag.

    2. I don't think you need the "null" after "format".

    I just ran bcp to create a format file without the quotes around the 3-part object name, and without the null, and it was created properly in the specified format file.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • Thanks, I was emclosing in quotes due to the "_" in the database name. One of our DBAs was able to create the file for me. Thaks for the reply though, I learned something...

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

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