5

I have a XSD file and many XML data files. What's the fastest way to create the database/tables from the XSD file and then load all XML files into the generated database schema?

For now, I don't care if it's using a code generation tool or whatever else. I just want to know the fastest way to do this.

3
  • 1
    Look at the XMLBulkLoad. Commented Jan 3, 2013 at 16:09
  • xml data can have a lot of different form... From a simple "list" to a full graph of object. I bet such tool won't exists, as it's virtually impossible to achieve. OR you use Sql Server as a xml repository (a single table with the Xml datatype, or a simple string). In fact it will depend both on what you are trying to achieve, and what you will do with the data once loaded. Commented Jan 3, 2013 at 16:10
  • Note that modern (>2008?) versions of SQL server do allow indexing XML "paths" and querying of XML via XPath. Unless your XML files are very simple, it'll probably be a lot easier and maybe even better in the long term to just use SQL server as a xml repository with XPath capabilities Commented Jan 3, 2013 at 16:13

1 Answer 1

3

Store the data as xml in the database:

  1. Create schema collection and create table: http://msdn.microsoft.com/en-us/library/ms176009.aspx
  2. Load xml into database: http://weblogs.sqlteam.com/mladenp/archive/2007/06/18/60235.aspx
  3. Query data: http://beyondrelational.com/modules/2/blogs/28/posts/10292/xml-workshops.aspx

Then you don't need to worry about having to create and maintain a load of tables.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that what i did, had a little help with this question stackoverflow.com/questions/1890923/… Its probably not the best option but the fastest one (as development speed not performance) for sure!
that #3 link seems to be not what i was expecting... maybe it is gone?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.