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.
| Author |
Topic |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2008-06-20 : 19:13:02
|
| Hi thereI have a problem I have tried to solve using FOR XML PATH, EXPLICIT and all. The problem I am having is that when trying to produce the xml the root node has 'task' as tag identifier <task id="1" ...> I guess you could call it, but I also want the child elements to have 'task' as their tag <task id="2" ...> . how can I go about getting that since I cannot name two views I am selecting from with same alias....Thanks!SELECT EquipmentID + 1 as id, EquipmentDescr as [name],'#99ccff' AS color,'true' AS [expand],(SELECT JobID + 2 AS id, 'Layout#' AS [name],'#99ccff' AS color,(SELECT [taskproperty-id] AS [taskproperty-id],[value] AS [value]FROM dbo.VXmlGanttBody custompropertyWHERE customproperty.JobID = task2.JobIDFOR XML AUTO, TYPE)FROM VJobs task2WHERE task2.EquipmentID = task.EquipmentIDFOR XML AUTO, TYPE ) FROM VEquipments taskORDER BY EquipmentDescrFOR XML AUTO, TYPE |
|
|
PeterNeo
Constraint Violating Yak Guru
357 Posts |
Posted - 2008-06-21 : 03:33:37
|
| TRY CHANGING FOR XML AUTO, TYPE WITH THE BELOW ONEFOR XML AUTO, TYPE, ROOT('ROOT') |
 |
|
|
|
|
|
|
|