April 1, 2008 at 2:53 pm
I need to import some XML into SQL7. Since SQL7 has no xml support I figure I'm going to use vbscript but I am having a hard time getting my head around accessing the individual elements so I can loop through the records and insert them into my table.
My XML looks something like this.
-
-
-
-
and I get it loaded using this
xmlDoc.async = False
xmlDoc.setProperty "ServerHTTPRequest", true
xmlDoc.load("http://somesite.com/download.asp")
for each x in xmlDoc.documentElement.childNodes
objExplorer.document.Body.InnerHTML = objExplorer.document.Body.InnerHTML & (x.text) & "
"
next
but x.text shows all three fields appeneded together so I need to access the individual elements to build my insert statement.
I am also open to any other methods of doing this, vbscript is one of my strong points which is why I chose this way.
April 1, 2008 at 7:38 pm
We can't see your XML because of the < and > in the code. You need to edit is to use the replacement text for them.
Do you have access to SQL 2005? If so you could use SSIS with an XML Source and a SQL 7 destination (using oledb).
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 1, 2008 at 8:15 pm
I will repost the XML when I get into the office tomorrow. If I had a newer version of SQL I could use the OPENXML and be done with it but alas I am stuck with this unsupported POS for the moment.
The xml is something like this
company
record
field1 data /field1
field2 data /field2
field3 data /field3
/record
record
field1 data /field1
field2 data /field2
field3 data /field3
/record
record
field1 data /field1
field2 data /field2
field3 data /field3
/record
/company
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply