Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Re: Subquery for xml

$
0
0

Hi Denis,

 

I think this error is expected.  The documentation section on " for xml subqueries"

includes the restriction

"A for xml subquery cannot be a correlated subquery. For more information on correlated subqueries, see the Transact-SQL User’s Guide."

 

Getting a result set that is a mix of plain values and xml output is going to be tricky,

the feature really was primarily intended to just return the whole result set as xml.

 

I'm not a big fan of cursors, but a way to get the results I think you want would be

to create a work table containing all the distinct values of cargo_type_list_code

and a varchar column to hold the xml filled with nulls.  The create a cursor to update the varchar column with the xml output for each individual value.  I haven't actually tried this.

 

-bret


Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>