我正在使用VS和SQL Server 2008开发SSIS应用程序。不过,我还是SSIS的新手。
我已成功创建了一个项目,其中一个XML任务连接到数据流任务。但作为同一解决方案的一部分,我使用连接到数据流任务的XML任务创建了一个相同的项目。
从我所看到的,两个项目之间的唯一区别是文件。虽然第一个包运行顺利,但第二个包失败并出现以下错误:
Error: 0xC02090FB at Data Flow Task, XML Source [1]: The "component "XML Source" (1)" failed because error code 0x80131537 occurred, and the error row disposition on "output column "WITHDRAWAL_DATE" (1689)" at "output "row" (28)" specifies failure on error. An error occurred on the specified object of the specified component.
Error: 0xC02092AF at Data Flow Task, XML Source [1]: The component "XML Source" (1) was unable to process the XML data. Pipeline component has returned HRESULT error code 0xC02090FB from a method call.
但是,我检查了这些文件,无法查看问题所在。我该怎么调试呢?输入XML文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<rows xmlns="http://www.w3.org/1999/xhtml">
<row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2007-07-03" ENTRYC_CODE="00" WITHDRAWAL_DATE="2007-08-31" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2008" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
</row>
<row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2008-07-08" ENTRYC_CODE="00" WITHDRAWAL_DATE="2008-07-24" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2009" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
</row>
<row OTHER_ID="100041" GRAD_YR="2011" LAST_NAME="VALENTO" FIRST_NAME="SARA" MIDDLE_NAME="JEAN" BIRTHDATE="1993-01-30" DISTRICT_CODE="" STUDENT_STATUS="A" STUDENT_ID="10172" ALPHAKEY="VALENSAR000" SCHOOL_ID="010" ADVISOR="0" EW_DATE="2009-07-07" ENTRYC_CODE="24" WITHDRAWAL_DATE="2009-08-06" WITHDRAWAL_CODE="99" WITHDRAWAL_SCHOOL_YEAR="2010" WITHDRAWAL_GRAD_YR="2011" X_WITHDRAWAL_RETAINED="false" CY_TEAM_SCHD_ID="" GRADUATED="false" MN_EDE_NBR="624000665509">
</row>
我的XSD文件如下:
<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="rows">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="row">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="OTHER_ID" type="xs:string" use="optional" />
<xs:attribute name="GRAD_YR" type="xs:decimal" use="optional" />
<xs:attribute name="LAST_NAME" type="xs:string" use="optional" />
<xs:attribute name="FIRST_NAME" type="xs:string" use="optional" />
<xs:attribute name="MIDDLE_NAME" type="xs:string" use="optional" />
<xs:attribute name="BIRTHDATE" type="xs:date" use="optional" />
<xs:attribute name="DISTRICT_CODE" type="xs:string" use="optional" />
<xs:attribute name="STUDENT_STATUS" type="xs:string" use="optional" />
<xs:attribute name="STUDENT_ID" type="xs:integer" use="optional" />
<xs:attribute name="ALPHAKEY" type="xs:string" use="optional" />
<xs:attribute name="SCHOOL_ID" type="xs:string" use="optional" />
<xs:attribute name="ADVISOR" type="xs:integer" use="optional" />
<xs:attribute name="EW_DATE" type="xs:date" use="optional" />
<xs:attribute name="ENTRYC_CODE" type="xs:string" use="optional" />
<xs:attribute name="WITHDRAWAL_DATE" type="xs:dateTime" use="optional" />
<xs:attribute name="WITHDRAWAL_CODE" type="xs:string" use="optional" />
<xs:attribute name="WITHDRAWAL_SCHOOL_YEAR" type="xs:integer" use="optional" />
<xs:attribute name="WITHDRAWAL_GRAD_YR" type="xs:integer" use="optional" />
<xs:attribute name="X_WITHDRAWAL_RETAINED" type="xs:boolean" use="optional" />
<xs:attribute name="CY_TEAM_SCHD_ID" type="xs:string" use="optional" />
<xs:attribute name="GRADUATED" type="xs:boolean" use="optional" />
<xs:attribute name="MN_EDE_NBR" type="xs:decimal" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
此外,当我忽略此输出错误时,程序包执行开始,但随后在另一个错误上失败:
conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value
答案 0 :(得分:2)
在XML Schema中,您已定义属性WITHDRAWAL_DATE
的类型为xs:date
。这意味着WITHDRAWAL_DATE
的内容必须采用YYYY-MM-DDThh:mm:ss
格式。您的XML代码具有WITHDRAWAL_DATE
格式YYYY-DD-MM
的属性值。因此,根据您的架构,这些值无效,并且使用此类值创建XML文档会创建无效的XML文档。
XML Schema没有格式为YYYY-DD-MM
的内置数据类型,因此您需要更改XML文档中使用的格式,或者在架构中为自己定义此属性的有效类型。 / p>