extracting values from typed xml in sql server
I have typed xml as one of the columns in my table (sql server 20开发者_JS百科08). I need to extract one specific value from this typed xml field. I checked across multiple sites, but only ways to extract a field from untyped xml alone is given. Help me in getting this gone.
If by typed you mean xml that has namespaces, try something like:
WITH XMLNAMESPACES ('http: //www.MySampleCompany.com' AS MY)
SELECT
chapters.node.value('../@title', 'nvarchar(50)') AS bookTitle
FROM @data.nodes('//MY:chapter') AS chapters(node)
Vote down or comment if I misunderstand your question.
精彩评论