469,271 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

CREATE TABLE using Xml Schema

I want to dynamically create tables in a SQL Server 2000 database that
are modelled after XML schemas. I will not know what the schemas
might look like until the documents arrive.

For example, I'd like to convert this schema:

<xs:schema
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

<xs:element name="OrgLevel">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="integer" />
<xs:element name="desc" type="string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

into this SQL command:

CREATE TABLE OrgLevel (code Int, desc varchar)

The problem is, when I walk the schema and read the name and type of
those elements, I get the correct names ("code", "desc"), but
messed-up XML-ized datatypes, like System.Xml.Schema.Datatype_int and
System.Xml.Schema.Datatype_string. How can I best determine the
equivalent SQL Server datatypes so I can build the commands to create
these tables effectively?
Nov 11 '05 #1
1 9009
You might want to check out XmlSpy 2005. It contains the ability to
create database tables for several dbms'es. However I only think it's
an option in the Enterprise edition but you can download a 30 days
trial.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andreas Bergmeier | last post: by
reply views Thread by Guy Deprez | last post: by
2 posts views Thread by masri999 | last post: by
2 posts views Thread by Amber | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.