﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / XQuery get value from node root without child nodes / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 21:00:40 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: XQuery get value from node root without child nodes</title><link>http://www.sqlservercentral.com/Forums/Topic1392332-392-1.aspx</link><description>Changexmltext.query('/PARAMS/FILTERS/CRM')toxmltext.query('/PARAMS/FILTERS/CRM/text()')</description><pubDate>Tue, 04 Dec 2012 04:01:27 GMT</pubDate><dc:creator>Mark-101232</dc:creator></item><item><title>XQuery get value from node root without child nodes</title><link>http://www.sqlservercentral.com/Forums/Topic1392332-392-1.aspx</link><description>hi guys,Still trying to get my head around XqueryI have the following logic [code="sql"]SET @CRM = (			SELECT TOP 1 CRM FROM 		(			SELECT 				cast(xmltext.query('/PARAMS/FILTERS/CRM')as nvarchar(max)) as 'CRM' 			FROM 				#XML 		) X	)[/code]Which returns me the following result[code="SQL"]&amp;lt;CRM&amp;gt;ONLY&amp;lt;TYPE&amp;gt;FSACLOSED&amp;lt;/TYPE&amp;gt;&amp;lt;TYPE&amp;gt;NRCLOSED&amp;lt;/TYPE&amp;gt;&amp;lt;/CRM&amp;gt;[/code]I would like to get hold of just the 'ONLY' part of this string, i.e. only the value under the root of the node, not the child nodes or their values.Can I do this with XQuery or do I need to use string manipulation to isolate it?</description><pubDate>Tue, 04 Dec 2012 03:42:59 GMT</pubDate><dc:creator>aaron.reese</dc:creator></item></channel></rss>