Friday, March 30, 2012

Importing XML

This might be a dumb question but I am not an exper on XML. I have
daily exports in XML format that need to be imported into SQL Server.
What's the easiest way of accomplishing what seems to be an easy task.
The XML schema is the same as the DB schema.
Many thanks...
BobCreate a stored procedure to handle this. BOL is pretty thorough on
importing XML data using SP.
MJKulangara
http://sqladventures.blogspot.com|||Which version of SQL Server are you using?
Anith|||2000|||In 2000, you have limited options. If you want to have the entire XML doc as
a single value, then you'd have to use a VARCHAR(n) or TEXT datatype in your
table & pass the entire doc through a stored procedure.
Another option is to create a ADO/OLEDB wrapper which executes the FOR XML
query and stream it back to the table. You can use sp_OA* procedures to call
these objects directly from t-SQL.
If you want to shred them into individual column, then you'll have to use
OPENXML along with sp_xml_* procedures.
Also refer to:
http://msdn.microsoft.com/library/e...penxml_759d.asp
Anith

No comments:

Post a Comment