General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
XML -> SQL Server problem
I've got some XML files that I want to 'shred' and store in SQL Server. I'm using OPENXML to do this, and it pretty much works, except for the body fields of the xml. These contain paragraph tags, and when OPENXML imports the files, it seems to strip the paragraph tags out.
Here is a snippet of my code:
INSERT INTO XMLin
SELECT *
FROM OPENXML(@hdoc,'/root/contentpackage/contentitem', 2)
WITH (
publisher varchar(50) './contentmetadata/contributor[@type="publisher"]/orgref/@resource',
loccity char(20) './contentmetadata/subject/subjectlocation/location/city',
headline varchar (50) './head/headline',
body text './body')
(Hope the formatting comes out ok)
I figure I have to do something with that last line to tell OPENXML to just import the contents of the body element in "raw" form, but I've no idea how to do that.
Any suggestions?Thanks in advance for any help!