none
conversion between types DT_UI1 and DT_I4 RRS feed

  • Question

  • I have an xml file e.g
    <?xml version="1.0" encoding="utf-8" ?>
    <books>
    <book id="1">
      <name>abc</name>
      <title>xyz</title>
    </book>
    <book id="2">
      <name>pqr</name>
      <title>lmn</title>
      </book>
    </books>

    xml schema:
    ---------------
    <?xml version="1.0"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="books">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" name="book">
              <xs:complexType>
                <xs:sequence>
                  <xs:element minOccurs="0" name="name" type="xs:string" />
                  <xs:element minOccurs="0" name="title" type="xs:string" />
                </xs:sequence>
                <xs:attribute name="id" type="xs:unsignedByte" use="optional" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    I want to move the data to a sql table.But i keep getting error conversion between types DT_UI1 and  DT_I4
    on the id column.
    My books table has ID with the datatype int and the rest as an nvarchar.
    Which i reckon thats why but how can i convert the my ID colum in the xml to an int.
    Thanks in advance
    Tuesday, June 9, 2009 6:58 AM

All replies