none
create table(s) from xml schema

    Question

  • I'm using SQL 2005.

    I have an XML schema that is maintained by an outside source and I'd like to use it to create the table structures. Is there a way to do this without manually creating the tables? I will be receiving data files that will need to be validated against the schema and then uploaded into a database.

    I suppose I could just load the xml into a single field using the xml data type, but it seems like it may be easier to access the data if it was broken out.

    Please let me know if anyone is aware of a tool that would automatically create the SQL tables from an XML schema.

     

    Thanks,

    John

    Tuesday, March 27, 2007 6:28 PM

Answers

  • You can use XML Bulk Load component to create your tables from  xml schema file :

    You can set the SchemaGen property to TRUE to create your tables.

     

    Refer Books on line SQL Server 2005 :

    SQL Server 2005 Books online -> 

                                SQL Server Programming Reference ->

                                                                            SQL XML 4.0 Programming ->

                                                                                                    Performing Bulk Load of XML Data (SQLXML 4.0) 

    Refer the following links to know more about XmlBulkLoad component: 

    Performing Bulk Load of XML Data (SQLXML 4.0)

    Using SQL Server's XML Support > XML Bulk Load

    How to import XML into SQL Server with the XML Bulk Load component

     

    Thanks

    Naras.

    Friday, March 30, 2007 5:24 AM
  •  Fatemeh.Akbari wrote:

    Hi

     

    i have a Scema File(XSD) and Value File (XML)

    i dont want to create Tabel and after  Import to Sqlserver 2005

    because it made me to read Scema file and find all fields and create Table

     

    is there way to create Table programaticaly from Schemma??

     

    best regards

    You could do this with SSIS. See this thread: http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3446990&SiteID=1

    Wednesday, June 11, 2008 1:01 PM

All replies

  • You can use XML Bulk Load component to create your tables from  xml schema file :

    You can set the SchemaGen property to TRUE to create your tables.

     

    Refer Books on line SQL Server 2005 :

    SQL Server 2005 Books online -> 

                                SQL Server Programming Reference ->

                                                                            SQL XML 4.0 Programming ->

                                                                                                    Performing Bulk Load of XML Data (SQLXML 4.0) 

    Refer the following links to know more about XmlBulkLoad component: 

    Performing Bulk Load of XML Data (SQLXML 4.0)

    Using SQL Server's XML Support > XML Bulk Load

    How to import XML into SQL Server with the XML Bulk Load component

     

    Thanks

    Naras.

    Friday, March 30, 2007 5:24 AM
  • Hi Naras,

     

    Thanks for  your reply.  It solved an issue of mine.

     

    Thanks

    Raghav

     

    Monday, November 19, 2007 10:10 PM
  •  

    Thanks Raghav.

    Please check the status as 'Answered'.

    Naras.

     

     

    Monday, November 19, 2007 10:39 PM
  • Hi

    Example is here    http://msdn.microsoft.com/en-us/library/ms171806.aspx


    Tuesday, May 13, 2008 7:44 AM
  • Hi

     

    i have a Scema File(XSD) and Value File (XML)

    i dont want to create Tabel and after  Import to Sqlserver 2005

    because it made me to read Scema file and find all fields and create Table

     

    is there way to create Table programaticaly from Schemma??

     

    best regards

    Sunday, June 01, 2008 5:41 PM
  •  Fatemeh.Akbari wrote:

    Hi

     

    i have a Scema File(XSD) and Value File (XML)

    i dont want to create Tabel and after  Import to Sqlserver 2005

    because it made me to read Scema file and find all fields and create Table

     

    is there way to create Table programaticaly from Schemma??

     

    best regards

    You could do this with SSIS. See this thread: http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3446990&SiteID=1

    Wednesday, June 11, 2008 1:01 PM
  •  Naras wrote:

    You can use XML Bulk Load component to create your tables from  xml schema file :

    You can set the SchemaGen property to TRUE to create your tables.

     

    Refer Books on line SQL Server 2005 :

    SQL Server 2005 Books online -> 

                                SQL Server Programming Reference ->

                                                                            SQL XML 4.0 Programming ->

                                                                                                    Performing Bulk Load of XML Data (SQLXML 4.0) 

    Refer the following links to know more about XmlBulkLoad component: 

    Performing Bulk Load of XML Data (SQLXML 4.0)

    Using SQL Server's XML Support > XML Bulk Load

    How to import XML into SQL Server with the XML Bulk Load component

     

    Thanks

    Naras.

     

    T am facing problem while uploading XML file into a Microsoft SQL Server 2000 database using SQLXML 3.0 Type library.

     

    It generates an exception of "No such interface supported". And it creates the table in database .... but it does not populates it that is does not insert records in it.

     

    I am working in C#... Microsoft Visual Studio 2005.

     

    More details can be viewed with "Code sample, XMl data file, XML Schema file and excption details" on

    http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3725328&SiteID=1&mode=1

     

    Any comments!!!

     

    Thanks

    Sunday, August 10, 2008 9:16 PM