August 20, 2009 at 5:00 am
Hi All,
I have simple and valid XML file "tree1.xml". I need to convert this xml file into a table "tbl_tree1" in my database.
I have replaced "<" with "(" and ">" with ")" in below xml file because of the display problem in this post.
(tree1)
(ID)1(/ID)
(Name)A(/Name)
(ParentID)0(/ParentID)
(Age)21(/Age)
(/tree1)
(tree1)
(ID)2(/ID)
(Name)B(/Name)
(ParentID)1(/ParentID)
(Age)25(/Age)
(/tree1)
(tree1)
(ID)3(/ID)
(Name)C(/Name)
(ParentID)1(/ParentID)
(Age)25(/Age)
(/tree1)
All the three records (
Regards,
Bhavesh
August 20, 2009 at 6:00 am
Hi,
I'd recommend to read through Jacob Sebastians articles "XML Workshop ..." (search for those keywords in this site).
It covers a lot of subject on how to deal with xml data.
I can't remember at the moment if the way to import a file into a xml variable (normally used in his examples) is easy to find.
If not, here's an example:
declare @xml xml
select @xml = convert(xml,BulkColumn)
from openrowset(bulk 'c:\yourfile.xml', single_blob) as f
Note: the xml stuff will be displayed (almost) correct if you use xml code tags as per the IFCode shortcut list on the lefthand side of the input box when you write a post...
August 20, 2009 at 7:32 am
anyone out there???
August 20, 2009 at 7:59 am
Yes, I'm here, waiting for some information from your side what you've found in the articles I pointed you at.
Did you actually check the articles I mentioned?
Maybe the people who did read your post were under the impression that you're not asking for help with a specific problem but you're requesting us to do your job... Chances for that to happen are limited. You have to show some effort, too.
For example by doing some research first and show us what you've tried and where you got stuck...
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply