16

Is there something available that could help me convert a XSD into SQL relational tables? The XSD is rather big (in my world anyway) and I could save time and boring typing if something pushed me ahead rather than starting from scratch.

The XSD is here if you want to have a look. It's a standardized/localized format to exchange MSDS.

rozon
  • 2,518
  • 4
  • 23
  • 37
  • possible duplicate of [How can I create database tables from XSD files?](http://stackoverflow.com/questions/138575/how-can-i-create-database-tables-from-xsd-files) – Yahoo Serious Jul 04 '13 at 11:35

3 Answers3

12

Altova's XML Spy has a feature that will generate SQL DDL Script from an XSD file. XML Spy will cost you some money though.

Interestingly enough, a developer used a really clever trick of using an XSLT translation to create the DDL script from an XSD file. They have outlined it in two parts here and here.

I might have to try this out myself for future use...

EDIT: Just found this question asked previously here...

Community
  • 1
  • 1
Dillie-O
  • 29,277
  • 14
  • 101
  • 140
1

There is a command-line tool called XSD2DB, that generates database from xsd-files, available at sourceforge.

For more info: please refer to this existing question How can I create database tables from XSD files?

Community
  • 1
  • 1
user3194532
  • 687
  • 7
  • 7
0

You can use an XSLT transform. See, for example, here: Generating SQL from XSD and XSL stylesheets with XSLT.

Microsoft has a command-line tool for performing XSLT transformations: Microsoft Command-Line tool for XSLT.

It is also easy to integrate the transforms into a build process using MSBuild or Grunt.

Here is the reference for the Microsoft documentation: XML Standards Reference, including XSD, XSLT, etc.

devinbost
  • 4,658
  • 2
  • 44
  • 57