SQL SERVER 2005 XML LOAD

5 pts.
Tags:
SQL Server 2005
XML
Hi EVeryone, Having a text file (in which resides the xml data and the xml schema definition),i have to create the afilliate tables to that XML(+XSD).The problem is the XSD is variable , and can not be hardcoded, i mean that XSD could vary from file to file... Is there a way to create automatically the tables and load them with data from the xml? Greets, Adrian

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can use BULK INSERT to load the entire XML file into a single field of a single record of a temp table. Then use OPENXML to query for the XML and XSD (I’m pretty sure you can query for the inline XSD in this mannor, if you you can probably figure it out by looping through the data structor directly). Use this information to dynamically create the CREATE TABLE scripts and then execute the scripts, then use dynamic SQL to load the data from the OPENXML into the new tables.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Denny Cherry
    Check out my SQL Server blog "SQL Server with Mr Denny" for more SQL Server information.
    66,190 pointsBadges:
    report
  • Iragor
    I am looking for more detail implementation
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following