<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://beyondrelational.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jacob's Blog - All Comments</title><link>http://beyondrelational.com/blogs/jacob/default.aspx</link><description>Welcome to my new blog!</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>re: FOR XML PATH - How to generate a Delimited String using FOR XML PATH?</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/08/14/for-xml-path-how-to-generate-a-delimited-string-using-for-xml-path.aspx#3793</link><pubDate>Thu, 04 Mar 2010 06:26:23 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:3793</guid><dc:creator>Zubair Khalid</dc:creator><description>&lt;p&gt;Thanks Alot for Knowledge sharing!&lt;/p&gt;
&lt;p&gt;thats what i needed!&lt;/p&gt;
&lt;p&gt;Zubair Khalid&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=3793" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 51 – Querying an RDF document using TSQL and XQuery</title><link>http://beyondrelational.com/blogs/jacob/archive/2010/02/16/xquery-lab-51-querying-an-rdf-document-using-tsql-and-xquery.aspx#3654</link><pubDate>Thu, 25 Feb 2010 09:15:32 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:3654</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;Thanks Brad, I made another post showing your method. &lt;a rel="nofollow" target="_new" href="http://beyondrelational.com/blogs/jacob/archive/2010/02/25/XQuery-Lab-52-A-More-Intuitive-way-of-reading-an-RDF-document.aspx"&gt;beyondrelational.com/.../XQuery-Lab-52-A-More-Intuitive-way-of-reading-an-RDF-document.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=3654" width="1" height="1"&gt;</description></item><item><title>re: Why do Excel 2007 prompt for repair when opening a document stored in SQL Server 2008 FILESTREAM Column?</title><link>http://beyondrelational.com/blogs/jacob/archive/2010/02/18/why-do-excel-2007-prompt-for-repair-when-opening-a-document-stored-in-sql-server-2008-filestream-column.aspx#3485</link><pubDate>Thu, 18 Feb 2010 10:27:19 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:3485</guid><dc:creator>Ritesh Shah</dc:creator><description>&lt;p&gt;absolutely fabulous trouble shooting!!!!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=3485" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 51 – Querying an RDF document using TSQL and XQuery</title><link>http://beyondrelational.com/blogs/jacob/archive/2010/02/16/xquery-lab-51-querying-an-rdf-document-using-tsql-and-xquery.aspx#3449</link><pubDate>Tue, 16 Feb 2010 23:59:28 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:3449</guid><dc:creator>Brad Schulz</dc:creator><description>&lt;p&gt;Hi Jacob...&lt;/p&gt;
&lt;p&gt;Good XML post. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The query could be re-worked to insert another CROSS APPLY to get the result columns and then you could use those column aliases in the WHERE clause. &amp;nbsp;This may make the query clearer AND it involves less typing and duplication.&lt;/p&gt;
&lt;p&gt;(The code may not be indented here as well as I&amp;#39;d like):&lt;/p&gt;
&lt;p&gt;;WITH XMLNAMESPACES(&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;&lt;a rel="nofollow" target="_new" href="http://www.w3.org/TR/RDF/&amp;#39;"&gt;http://www.w3.org/TR/RDF/&amp;#39;&lt;/a&gt; as r,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;&lt;a rel="nofollow" target="_new" href="http://purl.org/dc/elements/1"&gt;http://purl.org/dc/elements/1&lt;/a&gt;. 0/&amp;#39; as d,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;default &amp;#39;&lt;a rel="nofollow" target="_new" href="http://dmoz.org/rdf/&amp;#39;"&gt;http://dmoz.org/rdf/&amp;#39;&lt;/a&gt; &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;SELECT Resource, About, Title, CatID&lt;/p&gt;
&lt;p&gt;FROM @x.nodes(&amp;#39;RDF/Topic&amp;#39;) a(x)&lt;/p&gt;
&lt;p&gt;CROSS APPLY x.nodes(&amp;#39;link&amp;#39;) b(y)&lt;/p&gt;
&lt;p&gt;CROSS APPLY &amp;nbsp;@x.nodes(&amp;#39;RDF/ExternalPage&amp;#39;) c(z)&lt;/p&gt;
&lt;p&gt;CROSS APPLY (SELECT y.value(&amp;#39;@r:resource[1]&amp;#39;,&amp;#39;VARCHAR(100)&amp;#39;) AS Resource,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;z.value(&amp;#39;@about&amp;#39;,&amp;#39;VARCHAR(100)&amp;#39;) AS About,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;z.value(&amp;#39;d:Title[1]&amp;#39;,&amp;#39;VARCHAR(100)&amp;#39;) AS Title,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x.value(&amp;#39;catid[1]&amp;#39;,&amp;#39;VARCHAR(100)&amp;#39;) AS CatID) F&lt;/p&gt;
&lt;p&gt;WHERE Resource=About&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=3449" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 23 - Retrieving values and position of elements</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/08/21/xquery-lab-23-retrieving-values-and-position-of-elements.aspx#2915</link><pubDate>Mon, 25 Jan 2010 17:41:00 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:2915</guid><dc:creator>anand348</dc:creator><description>&lt;p&gt;Very interesting Post. I was looking for some thing like this for a very long time. &lt;/p&gt;
&lt;p&gt;I am not sure if you have covered this already, but the above approach is very useful in handling comma seperated strings and implementing array like functions.&lt;/p&gt;
&lt;p&gt;For Ex:&lt;/p&gt;
&lt;p&gt;DECLARE @Value NVARCHAR(MAX)&lt;/p&gt;
&lt;p&gt;SET @Value = &amp;#39;1,a,3,s,5,c,z,f&amp;#39;&lt;/p&gt;
&lt;p&gt;SET @x = &amp;#39;&amp;lt;Names&amp;gt;&amp;#39; + &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;&amp;lt;Name&amp;gt;&amp;#39; + &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;REPLACE( @Value, &amp;#39;,&amp;#39;, &amp;#39;&amp;lt;/Name&amp;gt;&amp;lt;Name&amp;gt;&amp;#39;) +&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#39;&amp;lt;/Name&amp;gt;&amp;#39; + &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;lt;/Names&amp;gt;&lt;/p&gt;
&lt;p&gt;Now, you have the XML used in your post.&lt;/p&gt;
&lt;p&gt;BTW, can you cover few more functions like position(), if there are.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=2915" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 1 - Transforming rows to columns</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/06/26/xquery-lab-1-transforming-rows-to-columns.aspx#2045</link><pubDate>Mon, 14 Dec 2009 10:37:47 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:2045</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;does this help?&lt;/p&gt;
&lt;p&gt;declare @t table (id int identity, data xml)&lt;/p&gt;
&lt;p&gt;insert into @t (data) &lt;/p&gt;
&lt;p&gt;select &amp;#39;&lt;/p&gt;
&lt;p&gt;&amp;lt;accountorder&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;source&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;sourceposition&amp;gt;1&amp;lt;/sourceposition&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;fundposition&amp;gt;1&amp;lt;/fundposition&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;fundposition&amp;gt;2&amp;lt;/fundposition&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/source&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/accountorder&amp;gt;&amp;#39;&lt;/p&gt;
&lt;p&gt;insert into @t (data) &lt;/p&gt;
&lt;p&gt;select &amp;#39;&lt;/p&gt;
&lt;p&gt;&amp;lt;accountorder&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;source&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;sourceposition&amp;gt;1&amp;lt;/sourceposition&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;fundposition&amp;gt;1&amp;lt;/fundposition&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;fundposition&amp;gt;3&amp;lt;/fundposition&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;percent&amp;gt;50&amp;lt;/percent&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/fund&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/source&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/accountorder&amp;gt;&amp;#39;&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt;p.value(&amp;#39;.&amp;#39;,&amp;#39;INT&amp;#39;) AS SourcePosition,&lt;/p&gt;
&lt;p&gt;v.value(&amp;#39;fundposition[1]&amp;#39;,&amp;#39;INT&amp;#39;) AS fundposition,&lt;/p&gt;
&lt;p&gt;v.value(&amp;#39;percent[1]&amp;#39;,&amp;#39;INT&amp;#39;) AS FundPercent&lt;/p&gt;
&lt;p&gt;FROM @t&lt;/p&gt;
&lt;p&gt;CROSS APPLY data.nodes(&amp;#39;/accountorder/source&amp;#39;) d(x)&lt;/p&gt;
&lt;p&gt;CROSS APPLY x.nodes(&amp;#39;sourceposition&amp;#39;) s(p)&lt;/p&gt;
&lt;p&gt;CROSS APPLY x.nodes(&amp;#39;fund&amp;#39;) AS f(v)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=2045" width="1" height="1"&gt;</description></item><item><title>re: PASS Outstanding Volunteer Award</title><link>http://beyondrelational.com/blogs/jacob/archive/2009/12/11/pass-outstanding-volunteer-award.aspx#2007</link><pubDate>Sat, 12 Dec 2009 10:49:40 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:2007</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;Thank you Pinal&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=2007" width="1" height="1"&gt;</description></item><item><title>re: PASS Outstanding Volunteer Award</title><link>http://beyondrelational.com/blogs/jacob/archive/2009/12/11/pass-outstanding-volunteer-award.aspx#2002</link><pubDate>Sat, 12 Dec 2009 07:52:13 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:2002</guid><dc:creator>Pinal Dave</dc:creator><description>&lt;p&gt;Jacob,&lt;/p&gt;
&lt;p&gt;First of all, Your hard work and identifying right people on to help you on team was tremendous job and you have successfully completed the same. &lt;/p&gt;
&lt;p&gt;We all know how many hours and hours you have spend on community front.&lt;/p&gt;
&lt;p&gt;You well deserved it and thank you for your good note to share your success with all of us.&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Pinal&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=2002" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 1 - Transforming rows to columns</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/06/26/xquery-lab-1-transforming-rows-to-columns.aspx#1854</link><pubDate>Wed, 02 Dec 2009 18:04:38 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1854</guid><dc:creator>mmorrow</dc:creator><description>&lt;p&gt;That worked awesome!!! If I wanted to incorporate that into a query of a table called psr with a field called psr_xml, how would I do that? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;With what you provided, I will be able to write a stored proc to pull a specified record, declare the xml variable, and return this result. &amp;nbsp;However, I would like to parse XML from multiple records, as well.&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1854" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 1 - Transforming rows to columns</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/06/26/xquery-lab-1-transforming-rows-to-columns.aspx#1842</link><pubDate>Wed, 02 Dec 2009 02:48:48 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1842</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;Try this query:&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt;	p.value(&amp;#39;.&amp;#39;,&amp;#39;INT&amp;#39;) AS SourcePosition,&lt;/p&gt;
&lt;p&gt;	v.value(&amp;#39;fundposition[1]&amp;#39;,&amp;#39;INT&amp;#39;) AS fundposition,&lt;/p&gt;
&lt;p&gt;	v.value(&amp;#39;percent[1]&amp;#39;,&amp;#39;INT&amp;#39;) AS FundPercent&lt;/p&gt;
&lt;p&gt;FROM @x.nodes(&amp;#39;/accountorder/source&amp;#39;) d(x)&lt;/p&gt;
&lt;p&gt;CROSS APPLY x.nodes(&amp;#39;sourceposition&amp;#39;) s(p)&lt;/p&gt;
&lt;p&gt;CROSS APPLY x.nodes(&amp;#39;fund&amp;#39;) AS f(v)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1842" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 1 - Transforming rows to columns</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/06/26/xquery-lab-1-transforming-rows-to-columns.aspx#1837</link><pubDate>Tue, 01 Dec 2009 23:43:57 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1837</guid><dc:creator>mmorrow</dc:creator><description>&lt;p&gt;I have tried in vain to adapt your advice to this XML:&lt;/p&gt;
&lt;p&gt;&amp;lt;accountorder&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;source&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;sourceposition&amp;gt;1&amp;lt;/sourceposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fundposition&amp;gt;1&amp;lt;/fundposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fundposition&amp;gt;2&amp;lt;/fundposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fundposition&amp;gt;3&amp;lt;/fundposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;percent&amp;gt;50&amp;lt;/percent&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/source&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/accountorder&amp;gt; &lt;/p&gt;
&lt;p&gt;I am trying to change the XML to a resultset like this:&lt;/p&gt;
&lt;p&gt;sourceposition &amp;nbsp; fundposition &amp;nbsp; percent&lt;/p&gt;
&lt;p&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/p&gt;
&lt;p&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/p&gt;
&lt;p&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&lt;/p&gt;
&lt;p&gt;If there are multiple source positions, I need those to display as additional rows, as well. &amp;nbsp;This is the query that I tried, and I just get NULL values.&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt;x.value(&amp;#39;(Field[@Name=&amp;quot;sourceposition&amp;quot;]/@Value)[1]&amp;#39;,&amp;#39;VARCHAR(20)&amp;#39;) AS sourceposition, &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;x.value(&amp;#39;(Field[@Name=&amp;quot;fundposition&amp;quot;]/@Value)[1]&amp;#39;,&amp;#39;VARCHAR(20)&amp;#39;) AS fundposition, &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;x.value(&amp;#39;(Field[@Name=&amp;quot;percent&amp;quot;]/@Value)[1]&amp;#39;,&amp;#39;VARCHAR(20)&amp;#39;) AS [percent]&lt;/p&gt;
&lt;p&gt;FROM @x.nodes(&amp;#39;/accountorder/source&amp;#39;) d(x)&lt;/p&gt;
&lt;p&gt;Thanks in advance for your help!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1837" width="1" height="1"&gt;</description></item><item><title>re: XQuery Lab 1 - Transforming rows to columns</title><link>http://beyondrelational.com/blogs/jacob/archive/2008/06/26/xquery-lab-1-transforming-rows-to-columns.aspx#1836</link><pubDate>Tue, 01 Dec 2009 23:43:57 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1836</guid><dc:creator>mmorrow</dc:creator><description>&lt;p&gt;I have tried in vain to adapt your advice to this XML:&lt;/p&gt;
&lt;p&gt;&amp;lt;accountorder&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;source&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;sourceposition&amp;gt;1&amp;lt;/sourceposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fundposition&amp;gt;1&amp;lt;/fundposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fundposition&amp;gt;2&amp;lt;/fundposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;percent&amp;gt;25&amp;lt;/percent&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;fundposition&amp;gt;3&amp;lt;/fundposition&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;percent&amp;gt;50&amp;lt;/percent&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/fund&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/source&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/accountorder&amp;gt; &lt;/p&gt;
&lt;p&gt;I am trying to change the XML to a resultset like this:&lt;/p&gt;
&lt;p&gt;sourceposition &amp;nbsp; fundposition &amp;nbsp; percent&lt;/p&gt;
&lt;p&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/p&gt;
&lt;p&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/p&gt;
&lt;p&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&lt;/p&gt;
&lt;p&gt;If there are multiple source positions, I need those to display as additional rows, as well. &amp;nbsp;This is the query that I tried, and I just get NULL values.&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt;x.value(&amp;#39;(Field[@Name=&amp;quot;sourceposition&amp;quot;]/@Value)[1]&amp;#39;,&amp;#39;VARCHAR(20)&amp;#39;) AS sourceposition, &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;x.value(&amp;#39;(Field[@Name=&amp;quot;fundposition&amp;quot;]/@Value)[1]&amp;#39;,&amp;#39;VARCHAR(20)&amp;#39;) AS fundposition, &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;x.value(&amp;#39;(Field[@Name=&amp;quot;percent&amp;quot;]/@Value)[1]&amp;#39;,&amp;#39;VARCHAR(20)&amp;#39;) AS [percent]&lt;/p&gt;
&lt;p&gt;FROM @x.nodes(&amp;#39;/accountorder/source&amp;#39;) d(x)&lt;/p&gt;
&lt;p&gt;Thanks in advance for your help!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1836" width="1" height="1"&gt;</description></item><item><title>re: Summary of my Experience at PASS 2009 Summit</title><link>http://beyondrelational.com/blogs/jacob/archive/2009/11/22/summary-of-my-experience-at-pass-2009-summit.aspx#1640</link><pubDate>Mon, 23 Nov 2009 12:15:41 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1640</guid><dc:creator>Jacob Sebastian</dc:creator><description>&lt;p&gt;Sure Ritesh!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1640" width="1" height="1"&gt;</description></item><item><title>re: Summary of my Experience at PASS 2009 Summit</title><link>http://beyondrelational.com/blogs/jacob/archive/2009/11/22/summary-of-my-experience-at-pass-2009-summit.aspx#1638</link><pubDate>Mon, 23 Nov 2009 11:35:03 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1638</guid><dc:creator>Ritesh Shah</dc:creator><description>&lt;p&gt;Article is really a great summary of pass summit but we are unfortunate enough that couldn&amp;#39;t attend your session, can we have demo in any of the coming user group?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1638" width="1" height="1"&gt;</description></item><item><title>re: Summary of my Experience at PASS 2009 Summit</title><link>http://beyondrelational.com/blogs/jacob/archive/2009/11/22/summary-of-my-experience-at-pass-2009-summit.aspx#1634</link><pubDate>Mon, 23 Nov 2009 09:53:44 GMT</pubDate><guid isPermaLink="false">6e5011fa-7db5-4df3-bb79-9085c1d333b3:1634</guid><dc:creator>havejeet</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for sharing, keep it up!&lt;/p&gt;
&lt;p&gt;regards,&lt;/p&gt;
&lt;p&gt;Jeet&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://beyondrelational.com/aggbug.aspx?PostID=1634" width="1" height="1"&gt;</description></item></channel></rss>