Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已键入 xml 作为表中的列之一(sql server 2008)。我需要从这个输入的 xml 字段中提取一个特定的值。我检查了多个站点,但只给出了从非类型化 xml 中提取字段的方法。帮我解决这个问题。
如果键入的意思是具有名称空间的 xml,请尝试以下操作:
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)
如果我误解了您的问题,请投票或发表评论。