Duplicate: Generating SQL Schema from XML
In a project i am working on, i have a need to support either a strongly-typed dataset for storing t
If you are working on SQL2005, you have the possibility to create a table with strongly typed XML columns, so that each value is validated against an XML Schema Collection (i.e. an XSD). However I cannot tell you anything about performance, scalability etc.
If you try to translate an XSD into a set of relational tables, you will find that there is no unique mapping between XSD elements and SQL tables:
An XSD child element may be implemented as detail table, as a set of columns representing the element (if only 1 child is allowed), or as mandatory/optional 1:1/1:n relation.
A collection of XSD child elements can be a master-detail relation, or an n:m relation stored in a separate table along with the attributes.
IIRC there is no definition of primary and unique constraints in XSD, which poses another problem in automated schema generation.
This all does not mean that nobody has yet bothered to develop a tool for such a task. But it certainly means that the task cannot be fully automated.