XML Bulk import problem
From: Microsoft (neil_owens_at__NO_SPAM_hotmail.com)
Date: 08/05/04
- Next message: Michael Rys [MSFT]: "Re: How to debug XML files"
- Previous message: Pavel: "Re: load/read/import XML file in SQL Server 2000"
- Next in thread: Michael Rys [MSFT]: "Re: XML Bulk import problem"
- Reply: Michael Rys [MSFT]: "Re: XML Bulk import problem"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 5 Aug 2004 19:00:36 +0100
I tried the samples in the SQL XML SP2 download and they worked just fine.
Now I'm getting the following error in the error file when trying this on
'my' data:-
<?xml version="1.0"?>
<Error>
<Record>
<HResult>0x80040E14</HResult>
<SQLState>42000</SQLState>
<NativeError></NativeError>
<ErrorState>1</ErrorState>
<Severity>16</Severity>
<Source>Microsoft OLE DB Provider for SQL Server</Source>
<Description><![CDATA[Bulk Insert failed. Unexpected NULL value in data file
row 1, column 1. Destination column (ServerID) is defined NOT NULL.]]>
</Description>
</Record>
</Error>
My XML data file is:
<MONITORREPORT>
<REPORT>
<SERVERID>115</SERVERID>
<REPORTDATE>27-Jul-04 23:59:25</REPORTDATE>
<COUNTERID>2</COUNTERID>
<DATA>0</DATA>
<COUNTERID>3</COUNTERID>
<DATA>59</DATA>
</REPORT>
</MONITORREPORT>
the XSD file is:-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:dt="urn:schemas-microsoft-com:datatypes"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="REPORT" sql:relation="PerfMonData">
<xsd:complexType>
<xsd:attribute name="SERVERID" sql:field="ServerID" type="xsd:integer"/>
<xsd:attribute name="REPORTDATE" sql:field="ReportDate"
type="xsd:dateTime"/>
<xsd:attribute name="COUNTERID" sql:field="MonitorObjID"
type="xsd:integer"/>
<xsd:attribute name="DATA" sql:field="Data" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
If I allow NULLs in the table, I get NULL's inserted into the SQL table but
not the data, so I think the parser isn't extracting the data. I'm using
VB6SP5 and SQLXMLSP2
The VB code is:-
Dim oBulkLoad As New SQLXMLBulkLoad3
oBulkLoad.ConnectionString = Connection
oBulkLoad.Transaction = True
oBulkLoad.ErrorLogFile = "d:\temp\bulkerrorlog.xml"
oBulkLoad.Execute "d:\monitor.xsd", "d:\monitor.xml"
Set oBulkLoad = Nothing
Any help greatly appreciated as the full data file is nearly 300MB and I so
want this to work.
TIA
Neil
- Next message: Michael Rys [MSFT]: "Re: How to debug XML files"
- Previous message: Pavel: "Re: load/read/import XML file in SQL Server 2000"
- Next in thread: Michael Rys [MSFT]: "Re: XML Bulk import problem"
- Reply: Michael Rys [MSFT]: "Re: XML Bulk import problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|