Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2008 在SQLServer2008中解析带有命名空间的XML_Sql Server 2008_Xml Parsing_Xml Namespaces - Fatal编程技术网

Sql server 2008 在SQLServer2008中解析带有命名空间的XML

Sql server 2008 在SQLServer2008中解析带有命名空间的XML,sql-server-2008,xml-parsing,xml-namespaces,Sql Server 2008,Xml Parsing,Xml Namespaces,我的表中有以下xml。我想获取fv节点的ID: 还是不 假设您的表名为YourTable,XML列名为XmlData,请根据您的实际情况进行调整和更改!,您可以尝试以下XQuery代码: -- declare the XML namespace as the DEFAULT ;WITH XMLNAMESPACES(DEFAULT 'bb_appfx_dataforms') SELECT -- extract the value from the <Value>

我的表中有以下xml。我想获取fv节点的ID: 还是不


假设您的表名为YourTable,XML列名为XmlData,请根据您的实际情况进行调整和更改!,您可以尝试以下XQuery代码:

-- declare the XML namespace as the DEFAULT
;WITH XMLNAMESPACES(DEFAULT 'bb_appfx_dataforms')
    SELECT
        -- extract the value from the <Value> subnode of the <fv> node, if found
        FvValue = XC.value('(Value)[1]', 'varchar(200)')
    FROM
        dbo.YourTable
    CROSS APPLY
        -- get a list of XML fragments - one for each <fv> node
        XmlData.nodes('/DataFormItem/Values/fv') AS XT(XC)
    WHERE
        -- find the XML fragment with the ID="Description"
        XC.value('@ID', 'varchar(50)') = 'Description'

欢迎来到Stackoverflow。如果你能分享一个
-- declare the XML namespace as the DEFAULT
;WITH XMLNAMESPACES(DEFAULT 'bb_appfx_dataforms')
    SELECT
        -- extract the value from the <Value> subnode of the <fv> node, if found
        FvValue = XC.value('(Value)[1]', 'varchar(200)')
    FROM
        dbo.YourTable
    CROSS APPLY
        -- get a list of XML fragments - one for each <fv> node
        XmlData.nodes('/DataFormItem/Values/fv') AS XT(XC)
    WHERE
        -- find the XML fragment with the ID="Description"
        XC.value('@ID', 'varchar(50)') = 'Description'