Creating an SQL Schema from an XML Schema Document


[This topic discusses a feature was first implemented for MSXML 6.0.]

An application that develops a TSQL script, or that programmatically creates a Microsoft SQL Server database table (or series of related tables based on an XML Schema), can be a useful tool. The application would provide you with a database containing the data types and constraints of the XML Schema, without requiring you to manually create the database. For such an application, you can use the SOM to extract the properties of the XML Schema so that they can be written to a SQL server. A text document could be created with the TSQL Database Definition Language (DDL) scripting needed to create database elements based on the properties of the XML Schema. The other alternative would be to use the SQL API to create the database directly, then read in information from an XML Schema document using the SOM. Either approach provides you with a complete database representation created from any XML Schema document.

Practical Uses of the SOM