August 15, 2014 at 10:47 am
I have XML files that need to be put into a table. The problem is that the nodes can range from 1 to ? and inside of some of those nodes some data changes from time to time. usually by one item. So I know how to put a defined amount in database and here I need to be able to change the columns on the fly for any XML document. Can I create columns dynamically each time I load an XML file into a SQL table?
August 15, 2014 at 11:23 am
With SELECT...INTO... you can create a table with the needed columns. However, what would you do next with that data? I assume that you'll insert base columns onto a table. What will you do with the changes in the XML file? How would you handle them?
August 15, 2014 at 2:08 pm
I'm looking to see if I can add columns dynamically to a SQL table
August 15, 2014 at 2:48 pm
Yes, you can do it with dynamic sql. The question is why would you do that.
Altering the schema to fit an xml file is wrong and should be done the other way around. You should transform your xml file to fit your predefined schema.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply