Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Yukon XQuery question
I am trying to query data in an XML variable and I am having trouble
getting the data out in the format that I would like.  Given the
following XML:
declare @myDoc xml
set @myDoc = '<Ownership
TeamGuid="23EA393A-3926-4A55-8329-FE747593379D" TeamName=".NET
Framework">
<Roles>
<Role Guid="93BDB4E2-95A0-438D-96E4-43032EB2BA16" Name="API Review
PM Contact" ContactAlias="John.Smith" Inherited="0" ArtifactName="" />
<Role Guid="8A7145EF-B48B-4A93-BFA5-28B53995C022" Name="Architect"
ContactAlias="John.Doe" Inherited="0" ArtifactName="" />
<Role Guid="BF727283-B18C-415A-A38C-CEC15CD341D9" Name="Corp VP"
ContactAlias="None" Inherited="0" ArtifactName="" />
</Roles>
</Ownership>'

What I would like to do is run an XQuery against the variable and get
attribute data back in normal rows and columns like the following:

Guid                                  Name
ContactAlias
------------------------------------  ---------------------
------------
93BDB4E2-95A0-438D-96E4-43032EB2BA16  API Review PM Contact  John.Smith
8A7145EF-B48B-4A93-BFA5-28B53995C022  Architect              John.Doe
BF727283-B18C-415A-A38C-CEC15CD341D9  Corp VP                None

I've checked the Query and Value methods and have not been able to get
them to do this for me.  Is this even possible w/XQuery?  Do I need to
use OpenXML to do what I am trying to accomplish?

Thanks for your help!


Report this thread to moderator Post Follow-up to this message
Old Post
Ken
07-27-05 06:28 PM


Re: Yukon XQuery question
Please post to the SQL Server 2005 groups:
http://communities.microsoft.com/ne...p=sqlserver2005

--
David Portas
SQL Server MVP
--



Report this thread to moderator Post Follow-up to this message
Old Post
David Portas
07-28-05 01:23 AM


Re: Yukon XQuery question
Ken  (kenjohnson77@hotmai
l.com)  writes:
> I've checked the Query and Value methods and have not been able to get
> them to do this for me.  Is this even possible w/XQuery?  Do I need to
> use OpenXML to do what I am trying to accomplish?

Look at the nodes() function.

But as David said, you should use the specific SQL 2005 newsgroups for
SQL 2005 questions. Not the least for XML/XQuery issues this can
increase the quality of reponses dramatically. :-)


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
07-28-05 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 12:30 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006