Home Forums SQL Server 2008 T-SQL (SS2K8) How do I use one column for node names and the others for elements in that node? RE: How do I use one column for node names and the others for elements in that node?

  • Timothy Graffham (9/19/2012)


    I was very excited to go to my post this morning and see 8 responses. I thought I was going to get some real help. Instead, the first response was an attempt but didn't help really, and then everyone just used my post for a chat about general complaints with XML as a technology.

    Very disappointing, folks. Can you please have those sort of conversations in their own threads?

    My format that I illustrated in the original question was not flexible. I MUST display this information in this format even if I have to loop through the data procedurally and dynamically build it as a string. It's an installed base issue that I have to support.

    My question is, is it possible? Can anyone tell me how to do this?

    OK, so now Matt and Eugene have shown that it can be done.

    The question now becomes will you be remiss in your responsibilities and not at least question why someone is asking for a format that isn't standard XML?

    "All that is necessary for the triumph of evil is that good men do nothing. -- Edmund Burke

    The SQLverse version:

    "All that is necessary for the triumph of bad database design is that good DBAs don't question. -- Dwain.C

    You can quote me.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St