If your XML document has XML namespaces, then you need to consider them in your queries!
So, if your XML looks like your sample, you need to:
-- define the default XML namespace to use ;WITH XMLNAMESPACES(DEFAULT 'bar') SELECT xuvalue('Name[1]', 'varchar(100)') as Name from @XMLDOC.nodes('/Feed/Product') x(u)
Or, if you prefer to have explicit control over which XML namespace to use (for example, if you have several), use XML namespace prefixes:
-- define the XML namespace ;WITH XMLNAMESPACES('bar' as b) SELECT xuvalue('b:Name[1]', 'varchar(100)') as Name from @XMLDOC.nodes('/b:Feed/b:Product') x(u)
marc_s
source share