none
BCP XML format file fails if column name contains spaces - looks like a bug RRS feed

  • Question

  •  

    Hi,

    I am using the following command

    master..xp_cmdshell 'bcp Staging.dbo.TableA format nul -f "\\Common\TableA.xml" -x -r"\n" -c -t -T'

     

    to generate a XML format file so that I could later use during import process and the structure of the table is

    CREATE TABLE TableA

    (

    [First Name] AS VARCHAR(50),

    LastName as VARCHAR(50)

    )

     

    it fails, it throws Error = [Microsoft][SQL Native Client]Format File : Invalid Field index.

    When I change the column name by removing space it works.

    Is there a work around for it, the reason being the Tables and format files has to be generated on the fly as its a requirement and I want to use the XML format instead of FMT type.

     

    Thanks

    Sathish

    Monday, November 19, 2007 8:30 PM