2

Here is an example to use SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class -

[STAThread]
   static void Main(string[] args)
   {   
         try
         {
            SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();
            objBL.ConnectionString = "Provider=sqloledb;server=server;database=databaseName;integrated security=SSPI";
            objBL.ErrorLogFile = "error.xml";
            objBL.KeepIdentity = false;
            objBL.Execute ("schema.xml","data.xml");
         }
         catch(Exception e)
         {
         Console.WriteLine(e.ToString());
         }
   }

It seems that schema.xml must be annotated with sql information to make importing successful. Regular xsd file does not work.

Is there any tools or ways to automate the generation of annotate information basing on xsd file? I could not find any through Internet Search. I wonder how SSIS can achieve this. Is there any component doing this so I can include it in my .NET application?

Don
  • 1,532
  • 4
  • 24
  • 47

1 Answers1

1

Unfortunately I don't believe there is, you have to add these things manually, as far as I'm aware. The upside is that it isn't too difficult, though, providing you don't hit any weird hiccups.

If you post your XSD and table structure maybe I can give you a hand.

Chuck Le Butt
  • 47,570
  • 62
  • 203
  • 289
  • Thanks! I found out that not tool existed for that after intensive research these days also. You are right it is not too complicated. I am writing a .NET programming to auto annotate it for now. Thanks for offering helps. – Don Nov 25 '10 at 18:19
  • I found that "SQLXML Bulkload 4.0 Type Library" is very slow. Shredding a 390 MB file into 10 tables without any transformation took me around an hour. Flatting this file into an in-memory table and importing it with SqlBulkCopy only took me around 6 minutes. Did you experience this? – Don Nov 28 '10 at 04:51