Home Forums Programming XML How to extract a value from XML column in a SQL Table RE: How to extract a value from XML column in a SQL Table

  • As Sean rightly mentioned, there are many ways of parsing and extracting values from an XML. Many of those methods are similar in syntax but may vary hugely in performance. For a single element attribute extraction such as your posted example, using the value method directly on the column is by far the most efficient way.

    😎

    Single element attribute extraction ( using Sean's sample data )

    SELECT

    SX.OldRow.value('(Airline/@lastUpdatedByUserID)[1]','INT') AS lastUpdatedByUserID

    FROM #Something SX;