XML Bulk Load - getting the XSD

  • Hi all,

    I am trying to get this damned SQL XML Bulk Load to work and I have found that I can pass the ADO command to load it into the database.

    The 2 parameters I need are:

    1.) The XSD

    2.) The XML file to import

    The problem I have is that the XSD file I have is from a 3rd party supplier and does not contain useful info to map to my database.  An extract of it is below:

    <xsd:complexType name="DocumentDetail">

                 <xsd:sequence>

                        <xsd:element name="CustomerRef">

                               <xsd:simpleType>

                                     <xsd:restriction base="xsd:string">

                                            <xsd:minLength value="1"/>

                                            <xsd:maxLength value="18"/>

                                     </xsd:restriction>

                               </xsd:simpleType>

                        </xsd:element>

                        <xsd:element name="RecordType">

                               <xsd:simpleType>

    This appears to just show a simple layout of the columns.  How do I get an XSD to map to my SQL table?  And also, will I be able to Bulk Load it in without this XSD?

  • Hello!

     

    There is a great tool the is called XSD (.exe) that comes with the .NET Framework...

    Happy hunting! Hanslindgren

  • Here is a website that we used. http://www.w3schools.com/schema/default.asp.  It is the best source for this area.

     

    Also here is a sample xsd that we had to create for our vendors data.  They supplied one but we had to midify it to work.

     

    <?xml version="1.0" encoding="utf-8" ?>

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:sql="urn:schemas-microsoft-com:mapping-schema">

            <xsd:element name="Travel" sql:is-constant="true">

              <xsd:complexType>

                <xsd:sequence>

                  <xsd:element name="PNR" sql:is-constant="true">

                    <xsd:complexType>

                      <xsd:sequence>

                        <xsd:element name="row" sql:relation="tblAmexPrePNRProcess">

                          <xsd:complexType>

                            <xsd:attribute name="pnr_locator" type="xsd:string" sql:field="PnrLocator" sql:datatype="char(6)"/>

                            <xsd:attribute name="gds_code" type="xsd:string" sql:field="GdsCode" sql:datatype="char(3)"/>

                            <xsd:attribute name="customer_id" type="xsd:string" sql:field="ClientId" sql:datatype="char(6)"/>

                            <xsd:attribute name="pax_sequence" type="xsd:string" sql:field="PassSeqNum"/>

                            <xsd:attribute name="cancel_indicator" type="xsd:string" sql:field="PnrCancelInd"/>

                            <xsd:attribute name="ticketed_indicator" type="xsd:string" sql:field="PnrTicketedInd"/>

                            <xsd:attribute name="agent_id" type="xsd:string" sql:field="PnrAgentId"/>

                         </xsd:complexType>

                        </xsd:element>

                      </xsd:sequence>

                    </xsd:complexType>

                  </xsd:element>

           <xsd:element name="Passenger" sql:is-constant="true">

                    <xsd:complexType>

                      <xsd:sequence>

                        <xsd:element name="row" sql:relation="tblAmexPrePassProcess">

                          <xsd:complexType>

                            <xsd:attribute name="pnr_locator" type="xsd:string" sql:field="PnrLocator" sql:datatype="char(6)"/>

                            <xsd:attribute name="gds_code" type="xsd:string" sql:field="GdsCode" sql:datatype="char(3)"/>

                            <xsd:attribute name="customer_id" type="xsd:string" sql:field="ClientId" sql:datatype="char(6)"/>

                            <xsd:attribute name="pax_sequence" type="xsd:string" sql:field="PassSeqNum"/>

                            <xsd:attribute name="pax_name" type="xsd:string" sql:field="PassName"/>

                           </xsd:complexType>

                        </xsd:element>

                      </xsd:sequence>

                    </xsd:complexType>

                  </xsd:element>

                </xsd:sequence>

              </xsd:complexType>

            </xsd:element>

    </xsd:schema>

    Hope this helps

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply