-1

Is that possible to parse and import an arbitrary XML file to SQL Server tables using C#?

The XML file can be highly hierarchical.

I have 1 Gb XML-file, I do not know anything about it.

How can I determine what tables it contains, create them at SQL Server and bulk load the data to SQL Server?

Is that possible?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162
  • 1
    It is not clear what you are asking here. You are using "shred", and "parse". Where do you want to do this - on the client or on SQL Server? Do you mean _pass_ XML to SQL Server? – Oded Apr 18 '12 at 12:35
  • Sorry for my terminology, English is not my native language :) – Andrey Gordeev Apr 18 '12 at 12:47
  • Please edit and improve the question then. I don't know what "shred" means at all in this context, and "parse" has a very specific meaning. Please explain what you want to do with the information as well. – Oded Apr 18 '12 at 12:49
  • 1
    i.e. I have 1 Gb XML-file, I do not know nothing about it. How can I determine tables in it, create them at SQL Server and bulk load data to SQL Server? Is that possible? – Andrey Gordeev Apr 18 '12 at 12:51
  • Please _edit_ your question and add the details in your last comment to it. – Oded Apr 18 '12 at 12:54

1 Answers1

1

No.

XML and SQL are very, very different things. It is possible to take SQL data an save it into XML, and such SQL-like XML can be converted back to an SQL database, but arbitrary XML that did not originate in an SQL-like system is not likely to be easily convertible to an SQL database schema in any meaningful way.

You could work out an SQL schema that represents generic XML in a key-value type design but it would not be an SQL schema in the traditional meaning of the word.

Larry Lustig
  • 49,320
  • 14
  • 110
  • 160