How to query untyped xml data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GinaMarano
    New Member
    • Nov 2009
    • 5

    How to query untyped xml data

    I have a varchar/text field that contains untyped xml. I don't want to use schema. How would one query this:

    Code:
    <configuration>
      <connectionsettings>
        <add key="appKey" value="355" />
        <add key="SessionURL" value="http://xxxxxx" />
        <add key="UpdateOrderURL" value="http://yyyyyyy" />
        <add key="IgnoreFailure" value="true" />
      </connectionsettings>
    </configuration>
    I want the "value" for 'IgnoreFailure'

    DECLARE @x XML
    select @x = myColumn from myTable where recordid = 1
    select @x.query(...

    ~Gina_M~
    Last edited by Niheel; Sep 29 '10, 09:55 PM.
  • GinaMarano
    New Member
    • Nov 2009
    • 5

    #2
    Got it!

    Select @x.value('(//connectionsetti ngs/add[@key="IgnoreFai lure"])[1]/@value', 'varchar(MAX)')

    ~Gina_M~

    Comment

    • Delerna
      Recognized Expert Top Contributor
      • Jan 2008
      • 1134

      #3
      I love it when somone solves their own question.
      I love it even more when they let us know.
      Good job Gina_M :)

      Comment

      • Steve Hindmarsh

        #4
        I hate it when this happens, what the devil is @x.value ?

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          Steve,

          Read this

          Good Luck!!!

          ~~ CK

          Comment

          Working...