Re: XML EXPLICIT PROBLEM
- From: "Michael Rys [MSFT]" <mrys@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 11:51:55 -0800
Are you using SQL Server 2000 or 2005? In the later case, I would recommend
to use the FOR XML Path mode.
AlsoI am nost sure why in your query below you would want to use a join if
you are using EXPLICIT mode or EXPLICIT mode at all. The example seems to be
too simple... Just use AUTO mode for getting an employee element with the
attributes nested in the jobs (where you join them using a left outer join
and an order by on job id)....
If the actual query is more complex, please provide it and the sample table
schemas....
Best regards
Michael
"ina" <roberta.inalbon@xxxxxxxxx> wrote in message
news:1143817402.399971.265780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello all,
I am newbie in sql server and I am particular interested in sqlxml; I
would like to transform sql queries in xml files but I have problem
with xml explicit.
here is my code:
select 1 as tag,
null as parent,
jobid as [job!2!jobid!],
lastname_employee as [employee!1!lastname_employee],
null as [employee!1!firstname_employee]
FROM employee
union all
select
2,
1,
jobid,
lastname_employee,
firstname_employee
from employee e inner join job j on j.jobid = e.jobid for xml explicit^
here I have an error: as
/*-----------------------------
select 1 as tag,
null as parent,
jobid as [job!2!jobid!element],
-----------------------------*/
Server: Msg 209, Level 16, State 1, Line 1
Ambiguous column name 'Jobid'.
What I would like to do it is:
<employee lastname_employee="user1 " jobid= "1"/>
<employee lastname_employee="user2" jobid="2"/>
Could someone kindly help me?
Ina :)
.
- References:
- XML EXPLICIT PROBLEM
- From: ina
- XML EXPLICIT PROBLEM
- Prev by Date: Re: Very Basic Question
- Previous by thread: XML EXPLICIT PROBLEM
- Index(es):
Relevant Pages
|