|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 7:33 AM
Points: 234,
Visits: 441
|
|
hi guys,
Still trying to get my head around Xquery
I have the following logic SET @CRM = ( SELECT TOP 1 CRM FROM ( SELECT cast(xmltext.query('/PARAMS/FILTERS/CRM')as nvarchar(max)) as 'CRM' FROM #XML ) X )
Which returns me the following result
<CRM>ONLY<TYPE>FSACLOSED</TYPE><TYPE>NRCLOSED</TYPE></CRM>
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?
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: 2 days ago @ 9:53 AM
Points: 1,501,
Visits: 18,208
|
|
Change
xmltext.query('/PARAMS/FILTERS/CRM')
to
xmltext.query('/PARAMS/FILTERS/CRM/text()')
____________________________________________________
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537
Never approach a goat from the front, a horse from the rear, or a fool from any direction.
|
|
|
|