RE: [xsl] extension to insert XML into a db

Subject: RE: [xsl] extension to insert XML into a db
From: "W Charlton" <XSLList@xxxxxxxxxx>
Date: Tue, 22 Jan 2008 11:37:12 -0000
Mario,

This is slightly off XSL but:

If you are using Microsoft SQL then you might want to look at
http://support.microsoft.com/kb/316018

Or 

http://msdn2.microsoft.com/en-us/library/aa276847(SQL.80).aspx

using the SQL OPENXML command.

A simple example would be something like:

SELECT    *
FROM       OPENXML (@idoc, '/ROOT/Customer',1)
            WITH (CustomerID  varchar(10),
                  ContactName varchar(20))

You can then insert or update this virtual table. 

We do quite a lot of this and it seems very efficient but when you hit a
problem (say trying to insert an invalid date into a Date field it is not
easy to spot the problem.

To make this relevant to XSL we often use XSL prior to the SQL to get the
XML in the right structure.


William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net


-----Original Message-----
From: Mario Madunic [mailto:hajduk@xxxxxxxx] 
Sent: 2008 January 21 17:05
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] extension to insert XML into a db

I was wondering if there is an extension that can insert XML into a db. I
know
of the SQL extension that comes with Saxon but it only inserts strings and
not
the elements. I've been creating CSV's and then using ANT with BCP to get
content that retains elements into SQLServer. It just seems to be the long
route.

Marijan (Mario) Madunic

Current Thread