2012年2月25日星期六

bcp data importing error when using xml format file

Hello, I have a question.

I'm performing some early test for bulk import/export using the bcp(9.0) utility, but there is a problem when working with an xml FormatFile. I execute the following command:

>bcp TestDB.dbo.myNewTable1 in myDataFile.dat -fmyXMLFormatFile.xml -SmySever

-UmyAccount -PmyPassword

And get the following error:


Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file

0 rows copied.

Please help me understand and fix this problem.

Thanks a lot! Best regards,
Diego Valdez

For XML format you suppose to use -x switch...

Please check BOL for more info.

-x

Used with the format and -f format_file options, generates an XML-based format file instead of the default non-XML format file. The -x does not work when importing or exporting data. It generates an error if used without both format and -f format_file.

|||I don't think you understood my post...
My problem is not in the generated xml format file. This file was created succesfully. The issue arises when I try to import data with my specified bcp command and seems that there is something wrong with the Data File, as the message I get says "Unexpected EOF encountered in BCP data-file"
Hope someone can help me get around this.|||There maybe a problem with the data file but you need to get BCP to read your format file first as it could be a spurious error thats getting thrown, right now your commandline is not valid.

没有评论:

发表评论