我在这样的列中有一些xml。
<ScopedWorkflowConfiguration xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/workflow/2012/xaml/activities">
<appSettings>
<AppSetting>
<Key>CurrentWebUri</Key>
<Value>http://myurl.org</Value>
</AppSetting>
</appSettings>
</ScopedWorkflowConfiguration>
尝试选择“值”节点的值。
;WITH Casted AS (SELECT t.Id, t.[Configuration] As XmlData FROM dbo.MyTable AS t)
Select Distinct
Id
,pv.value('//*:Key="CurrentWebUri"/Value', 'nvarchar(max)') As CurrentWebUri
From
Casted
Cross Apply Casted.XmlData.nodes(N'//*:ScopedWorkflowConfiguration//*:appSettings//*:AppSetting') AS A(pv)
我知道我已经接近了-但是我在这里的语法有麻烦://:Key =“ CurrentWebUri” / Value *
上面的查询导致此错误:
/需要一个节点或一组节点
您能帮忙吗?
缺少默认的名称空间声明,并且XPath表达式已关闭。