Advertisement

07.22.2008 at 04:58AM PDT, ID: 23584783 | Points: 500
[x]
Attachment Details

How do I retrieve a subquery as XML data in a regular recordset

Asked by adobe116 in MS SQL Server, Extensible Markup Language (XML)

Tags: Microsoft SQL Server, T-SQL

Hey everyone, I'm assuming this has been asked before, but I searched for a bit but couldn't find it; maybe I'm using the wrong terminology?

Let's say I have 4 tables, one called Documents that holds abstract data.  The other 3 are Leases, Divorces, and Sales.  The document Table holds data shared between each of the other three types of documents, such as Title, Author, Pages, etc AS WELL AS the documentType(one of the other 3 tbls).  The Sales table contains fields like SaleDate, SaleAmount, Seller, Purchaser, etc.  The Leases table contains Leasee, Leasor, LeaseTerm, etc.

So any document I add to my system would use the "Documents" table plus its own table.  BTW, this example is in chapter 7 (pg 176) of Robert Vieira's "Professional SQL Server 2005 Programming" from WROX. (Good book, easy to read)

So now I can create 3 views for each of the concrete Document types to retrieve data for each.  The problem comes in when I want to query the documents all at once.  I was thinking of combining the common fields where possible under a general name, and then including the rest as XML.

Has anyone done anything like this already?  I'm using SQL2005.  Any ideas or suggestions are appreciated.

-JimStart Free Trial
[+][-]07.22.2008 at 05:06AM PDT, ID: 22058393

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 05:22AM PDT, ID: 22058504

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 05:32AM PDT, ID: 22058589

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 06:23AM PDT, ID: 22059046

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 05:02PM PDT, ID: 22064824

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.14.2008 at 12:47PM PDT, ID: 22233642

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628