XML Query

  • diego.perdices

    SSCommitted

    Points: 1701

    Comments posted to this topic are about the item XML Query

  • setiv

    Mr or Mrs. 500

    Points: 536

    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.

  • lucky-80472

    SSCertifiable

    Points: 7793

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

    anybody else?


    Lucky

  • abinder-1080408

    SSC Rookie

    Points: 43

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

  • abinder-1080408

    SSC Rookie

    Points: 43

    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.

  • SanjayAttray

    SSChampion

    Points: 13157

    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.

  • SanjayAttray

    SSChampion

    Points: 13157

    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.

  • mtassin

    SSC-Insane

    Points: 23099

    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]

  • setiv

    Mr or Mrs. 500

    Points: 536

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

  • mtassin

    SSC-Insane

    Points: 23099

    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]

  • KevinC.

    SSCommitted

    Points: 1570

    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.

  • setiv

    Mr or Mrs. 500

    Points: 536

    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?

  • Damian Widera-396333

    Ten Centuries

    Points: 1186

    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

  • Stefano Bozzoni

    Newbie

    Points: 9

    Quiz doesn't work at all booooh!!

  • Muhammed Rafiq

    SSC Eights!

    Points: 921

    Me too get same result for all 4 options

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

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