?
Solved

How-to create a SQL Server 2005 table structure using an XML and/or XSD file

Posted on 2007-10-17
4
Medium Priority
?
1,562 Views
Last Modified: 2008-09-20
I currently have an XML and XSD file (XSD autogenerated from a program like XMLSPY against the XML file) and would like to create a SQL table structure by using either file. I have attempted to import into Access but our XML file utilizes both attributes, elements and empty namespace values and simply does not import correctly. Will I have to manually create the table structures so that I can import the XML data?
0
Comment
Question by:drgdrg
2 Comments
 
LVL 12

Accepted Solution

by:
jkmyoung earned 2000 total points
ID: 20096220
The schema generated by XmlSpy probably does not reference the fields of your database in each element.

Eg, do you have something like the following?
xmlns:sql="urn:schemas-microsoft-com:mapping-schema"

<xsd:element name="product" sql:relation="table_1" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="localkey" type="xsd:string" sql:field="localkey" />
<xsd:element name="name" type="xsd:string" sql:field="name" />

Note the sql: prefixed attributes.
http://www.aprogrammersjournal.com/article.aspx?id=62

Hopefully this gives you a start as to what you need to add to your schema.
0
 
LVL 1

Author Comment

by:drgdrg
ID: 20097002
Is there some sort of automatic method / wizard?  For example, in Access 2007, it will look at the XML data - no XSD required - and build all required tables and fields.  However, it only builds for the elements, not the attributes.  

If there some sort of functionality like this in SQL 2005 or other tools that accomplish this?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question