Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
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
vaibhavktiwari83
Aged Yak Warrior
843 Posts
Posted - 2010-09-16 : 10:24:09
try this -
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>'SELECT b.value('@EMAIL', 'varchar(30)') AS EMAIL, b.value('@PHONE', 'varchar(30)') AS PHONE FROM @xml.nodes('/P') AS xmldata(fileds)CROSS APPLY Fileds.nodes('REC_LIST/REC') AS a(b)
Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER