﻿<?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 2005 / T-SQL (SS2K5)  / select from XML type ntext / 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>Sat, 25 May 2013 13:22:57 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>The overhead will depends on how much data you're talking about.If the individual XML packages are small, it won't add much at all.  If they're large, it'll add more.To put it in perspective, I've processed a 100 Meg XML file on my desktop machine, with an old Pentium D dual-core and 2 Gig of RAM, and it was plenty fast and didn't strain the system at all.  If a slightly aged desktop machine can handle that, then it shouldn't be a strain for any reasonably well-built server.So, you'll have to judge it based on the size of the data being processed.</description><pubDate>Wed, 15 Jul 2009 13:04:11 GMT</pubDate><dc:creator>GSquared</dc:creator></item><item><title>RE: select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>Thanks - GSquared,I get the result. I'll work with this. I need to parse out a few 100s of such XMLs and will this add overheads to the servers.We are hosted and if any of our process is a overkill, they will remove the functionality. I need to read this only. There is no write.</description><pubDate>Wed, 15 Jul 2009 12:06:23 GMT</pubDate><dc:creator>chandrika5</dc:creator></item><item><title>RE: select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>Make sure you copy from the "Quote" function, not "Copy and Paste", because the code windows on this site may be messing with the case of the words in the XML, and XML is case-sensitive.</description><pubDate>Wed, 15 Jul 2009 11:31:35 GMT</pubDate><dc:creator>GSquared</dc:creator></item><item><title>RE: select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>That's odd.  I get this:[code]Node	IDT	varVal	MyColumn&lt;simpleTable idt="d1" varVal="1"&gt;Some Value1&lt;/simpleTable&gt;	d1	1	Some Value1&lt;simpleTable idt="d2" varVal="1"&gt;Some Value2&lt;/simpleTable&gt;	d2	1	Some Value2&lt;simpleTable idt="d3" varVal="1"&gt;some Value3&lt;/simpleTable&gt;	d3	1	some Value3&lt;simpleTable idt="d4" varVal="1"&gt;some Value4&lt;/simpleTable&gt;	d4	1	some Value4&lt;simpleTable idt="d5" varVal="1"&gt;Some Value5&lt;/simpleTable&gt;	d5	1	Some Value5&lt;simpleTable idt="r1" varVal="5"&gt;My Local Path&lt;/simpleTable&gt;	r1	5	My Local Path&lt;simpleTable idt="r2" varVal="5"&gt;My documents Path&lt;/simpleTable&gt;	r2	5	My documents Path&lt;simpleTable idt="r3" varVal="5"&gt;My Programs Path&lt;/simpleTable&gt;	r3	5	My Programs Path&lt;simpleTable idt="r4" varVal="5"&gt;My Pictures Path&lt;/simpleTable&gt;	r4	5	My Pictures Path&lt;simpleTable idt="r5" varVal="5"&gt;My videos Path&lt;/simpleTable&gt;	r5	5	My videos Path[/code]Are you sure you copied it correctly?</description><pubDate>Wed, 15 Jul 2009 11:30:14 GMT</pubDate><dc:creator>GSquared</dc:creator></item><item><title>RE: select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>Hi,I just ran the SQL and do not get anything!</description><pubDate>Wed, 15 Jul 2009 11:21:40 GMT</pubDate><dc:creator>chandrika5</dc:creator></item><item><title>RE: select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>Take a look at this, see if you can work with it:[code]declare @String varchar(max), @XML XML;select @String = '&lt;Seq&gt;&lt;MyElement Number="12"&gt;&lt;InnerElement&gt;&lt;simpleTable idt="d1" varVal="1"&gt;Some Value1&lt;/simpleTable&gt;&lt;simpleTable idt="d2" varVal="1"&gt;Some Value2&lt;/simpleTable&gt;&lt;simpleTable idt="d3" varVal="1"&gt;some Value3&lt;/simpleTable&gt;&lt;simpleTable idt="d4" varVal="1"&gt;some Value4&lt;/simpleTable&gt;&lt;simpleTable idt="d5" varVal="1"&gt;Some Value5&lt;/simpleTable&gt;&lt;/InnerElement&gt;&lt;InnerElement&gt;&lt;simpleTable idt="r1" varVal="5"&gt;My Local Path&lt;/simpleTable&gt;&lt;simpleTable idt="r2" varVal="5"&gt;My documents Path&lt;/simpleTable&gt;&lt;simpleTable idt="r3" varVal="5"&gt;My Programs Path&lt;/simpleTable&gt;&lt;simpleTable idt="r4" varVal="5"&gt;My Pictures Path&lt;/simpleTable&gt;&lt;simpleTable idt="r5" varVal="5"&gt;My videos Path&lt;/simpleTable&gt;&lt;/InnerElement&gt;&lt;/MyElement&gt;&lt;/Seq&gt;'select @XML = @String;select 	Node, 	Node.value('(/simpleTable/@idt)[1]','char(2)') as IDT,	Node.value('(/simpleTable/@varVal)[1]','varchar(100)') as varVal,	Node.value('(/simpleTable)[1]','varchar(100)') as MyColumnfrom	(select X.Y.query('.') as Node	from @XML.nodes('Seq/MyElement/InnerElement/simpleTable') X(Y)) Z;[/code]The result I get from this looks like it could easily be concatenated into what you want.Does that help?</description><pubDate>Wed, 15 Jul 2009 10:31:52 GMT</pubDate><dc:creator>GSquared</dc:creator></item><item><title>select from XML type ntext</title><link>http://www.sqlservercentral.com/Forums/Topic753647-338-1.aspx</link><description>My sample XML is:&lt;Seq&gt; &lt;MyElement Number="12"&gt;  &lt;InnerElement&gt;  &lt;simpleTable idt="d1" varVal="1"&gt;Some Value1&lt;/simpleTable&gt;  &lt;simpleTable idt="d2" varVal="1"&gt;Some Value2&lt;/simpleTable&gt;  &lt;simpleTable idt="d3" varVal="1"&gt;some Value3&lt;/simpleTable&gt;  &lt;simpleTable idt="d4" varVal="1"&gt;some Value4&lt;/simpleTable&gt;  &lt;simpleTable idt="d5" varVal="1"&gt;Some Value5&lt;/simpleTable&gt;  &lt;/InnerElement&gt; &lt;InnerElement&gt;  &lt;simpleTable idt="r1" varVal="5"&gt;My Local Path&lt;/simpleTable&gt;  &lt;simpleTable idt="r2" varVal="5"&gt;My documents Path&lt;/simpleTable&gt;  &lt;simpleTable idt="r3" varVal="5"&gt;My Programs Path&lt;/simpleTable&gt;  &lt;simpleTable idt="r4" varVal="5"&gt;My Pictures Path&lt;/simpleTable&gt;  &lt;simpleTable idt="r5" varVal="5"&gt;My videos Path&lt;/simpleTable&gt;  &lt;/InnerElement&gt;   &lt;/MyElement&gt;&lt;/Seq&gt;The SQL:select cast(xmlString as xml).value('(/Seq/MyElement/InnerElement)[1]','nvarchar(3000)')   AS 'One',cast(xmlString as xml).value('(/Seq/MyElement/InnerElement)[2]','nvarchar(3000)')    AS 'Two'from myTableGives Me:One                                  TwoSome Value1Some Value2SomeValue3 ... My Local PathMy documents PathMy Programs PathI need to stick in a delimiter between:Some Value1|some Value 2| ....   My Local Path|My documents Path|My Programs PathIs it possible via SQL</description><pubDate>Wed, 15 Jul 2009 10:17:01 GMT</pubDate><dc:creator>chandrika5</dc:creator></item></channel></rss>