peleg
SSCrazy
Points: 2611
More actions
September 16, 2010 at 6:27 am
#229308
i have an xml :
Declare @xml as xmlset @xml='<P> <REC_LIST> <REC EMAIL="aaa@some.com" PHONE="2222231000" /> <REC EMAIL="aaa@some.com" PHONE="1212121212" /> </REC_LIST></P>'
Declare @xml as xml
set @xml='
<P>
<REC_LIST>
<REC EMAIL="aaa@some.com" PHONE="2222231000" />
<REC EMAIL="aaa@some.com" PHONE="1212121212" />
</REC_LIST>
</P>'
and i want to query the attributes from the @xml,something like :
select @xml.query(@email),@xml.query(@phone)
how do i do it?
thnaks
Mark Cowne
One Orange Chip
Points: 26954
September 16, 2010 at 7:03 am
#1222145
SELECT r.value('@EMAIL','VARCHAR(30)') AS EMAIL,
r.value('@PHONE','VARCHAR(30)') AS PHONE
FROM @xml.nodes('/P/REC_LIST/REC') AS x(r)
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply