Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Doing a join between XML data typed field and a relational table in Yukon (SQL 2005) >Thread Next - Re: Doing a join between XML data typed field and a relational tab Re: Doing a join between XML data typed field and a relational table in Yukon (SQL 2005)To: NULL Date: 8/1/2004 4:13:00 PM You can use ordinary sql join syntax, i.e. sqlxml, even for xml fields.
use db1
go
--create table t1 (pk int, t varchar(5))
go
--insert into t1 values(1,'a')
go
--create table t2 (fk int, x xml)
go
--insert into t2 values(1, '<x/>')
go
select * from t1 INNER JOIN t2 ON t1.pk = t2.fk for xml auto, elements,
root('x')
For additional query against xml field, you can use XQuery
"Nitsan" <nitsan.shaked@i...> wrote in message
news:31b6c8ae.0407120307.29fa2ff5@p......
> Hello,
>
> I have a Yukon XML question and would be very happy if someone can
> assist:
>
> Let's assume I have 2 tables:
>
> One will be product table ?Regular relational table with Product ID
> as a primary key and some descriptive fields.
>
> Second is an Order table ?it has Order ID as a PK and Order details
> which is a field of XML data type and holds all lines in the order
> including quantity, product id, prices, etc.
>
> I want to make a join that will present the orders with all product
> details for each order line.
>
> Do you know how can I do a Join between XML field and relational
> table?
>
> Thanks,
> Nitsan
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
