SQL Server: bcp import from a xml file causes error

时间:2017-05-16 09:25:53

标签: sql-server bcp

I have a XML file dumped using bcp. Now I am trying to import it back, but it causes an error saying

Unexpected end of file

My file looks like this:

<Records>
    <Record>
        <fileiid>6D6CB8B3-6FC0-E611-80CE-00155D04A60B</fileiid>
        <filesaveiid>2016121214342797001775113117639160154</filesaveiid>
        <datafilename>Howard Ray.png</datafilename>
        <datafilesize>0.03167057</datafilesize>
        <contenttype>.png</contenttype>
        <dataiid>2</dataiid>
        <createdon>2016/12/12 14:34:28</createdon>
        <createdby>mcarpenter</createdby>
        <modifiedon>2016/12/12 14:34:30</modifiedon>
        <modifiedby>mcarpenter</modifiedby>
        <annotation>iVBORw0KGgoAAAANSUhEUgAA.................</annotation> 
    <Record>
    ...
</Records>

Error:

[Microsoft][ODBC Driver 13 for SQL Server]Unexpected EOF encountered in BCP data-file

Command used:

exec xp_cmdShell 'bcp.exe [PREMIUM_DEMO_0]..[VG_Test] in d:\bcptest.xml  -c -T -x'

Do I really need to specify EOF to an XML based content?

0 个答案:

没有答案