April 23, 2009 at 6:43 am
declare @appro_xml xml ;
set @appro_xml='
ghfh
sjkfhjklfhasdkfhsd
afsjkhf
'
select
x.col.value('SolicitationID[1]','INT')AS request_id ,
d.dec.value('DeclineReasonCode[1]','varchar(500)')AS DeclineReasonCode
-- , x.col.value('DBAName[1]','VARCHAR(500)')AS DBAName
FROM @appro_xml.nodes('//ScoreAndDataRetrievalRequest') x(col)
CROSS APPLY col.nodes('DeclineReasonCode') d(dec)
April 23, 2009 at 7:04 am
First, if there's supposed to be XML in the post, you need to surround it with the correct tags, or convert the carrets to HTML codes.
Second, did you have a question or anything like that?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 23, 2009 at 8:58 am
I edited the code.
If you have a question, the title / description is not the place to put it.You also need to describe what issue you are having and what goal you have. There is no "best" way.
April 23, 2009 at 9:00 am
Steve:
This one's actually a pretty much duplicate post. He and Flo have been discussing the same thing, with the same problems in his posts, on another thread.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 23, 2009 at 9:02 am
I am getting problem parsing the xml using t-sql,
Not getting all node value...
any idea...
April 23, 2009 at 9:08 am
What do you want to get? What are you trying for?
Give some sample data, show what you want the output to be, include and error messages, etc.
April 23, 2009 at 9:09 am
Closing thread. Please post here: http://www.sqlservercentral.com/Forums/Topic703170-338-1.aspx
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply