XML Query

  • Comments posted to this topic are about the item XML Query

  • SELECT id as 'data()',

    customer as 'data()'

    FROM #customers AS customesra

    ORDER BY customer DESC

    FOR XML PATH(''),ROOT('customers')

    I cannot view the full XML string.

  • I'm getting the same result for all the 4 queries posted.

    anybody else?


    Lucky

  • "None of them" was not a choice so I picked all of them since they all return the same result.

  • To setiv:

    If you want everything you need to set the "Results To Text" option. It's under Tools/Options/Query Results/SQL Server or better yet, if you have the right toolbar showing you can just click on the icon.

  • I am bad at XML, actually very bad. Have to execute each code in SSMS and then see the difference.

    But still, what acually is different in C except that you see alias customersa and customersb, where as results are same and what is common between A, B and D queries ?

    May be a person with good XML knowledge can explain.

    SQL DBA.

  • lucky-80472 (10/7/2009)


    I'm getting the same result for all the 4 queries posted.

    anybody else?

    you see alias customersa and customersb in the resultset of C. where as in all other queries it's customers.

    SQL DBA.

  • Sanjay is right.... it got me because I wasn't reading clearly.

    <customersa customers.id="6">

    Is not the same as

    <customers customers.id="6">

    🙂 Good question... shows me why I hate xml as much as I do 🙂



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • This will not help. I need to buy a new computer.

  • Setiv,

    also open Tools -> Options -> Results to text and set the maximum length to a value higher than 256. I set mine to 4000 which works wonderfully 🙂



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Setiv: You can also set Tools -> Options... -> Query Results -> Results to File and save the file as a text document (change the file type to All Files). However, I do recommend mtassin's suggestion over the Results to File option. Still, it's good to know all of your options so as to make a better decision.

    --

    KevinC.

  • When querying A

    (SQLServer2005, SQLServer2005_SSMSEE) displays:

    "

    <customers><customers id="6"><customers customer="Victoria"/>

    </customers><customers id="2"><customers customer="Lyss"/>

    </customers><customers id="1"><customers customer="John"/>

    </customers><customers id="3"><customers customer="Jack"/>

    </customers><customer

    "

    This may be the result of installation of incomplete version

    (SQLServer2005, SQLServer2005_SSMSEE)

    What Kit you can recommend?

  • The third query gives other result than first tree - look at the element names

    Kindest Regards,

    Damian Widera
    SQL Server MVP,
    MCT, MCSE Data Platform, MCSD.NET

  • Quiz doesn't work at all booooh!!

  • Me too get same result for all 4 options

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply