Search code examples
sqlxmlxsdsqlbulkcopysqlxml

Get a valid schema of large (1 GB) xml files


I need to bulk load huge xml files to SQL Server 2005. I decided to use SQLXMLBULKLOAD in my C# app, but I need to get valid xsd-schemas of those xml files to load them. Which is best way to generate xsd file? I tried MS VS xsd.exe, but it tries to load the file into memory, which causes OutOfMemory exception.

Thanks!


Solution

  • Strip the file down to create a smaller one that is representative of the whole, then generate an XSD from that. You can then tailor the result if necessary.