Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do inside quotes
Message
From
10/09/2013 20:47:55
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 6.5 and older
Application:
Web
Miscellaneous
Thread ID:
01582787
Message ID:
01582804
Views:
41
There are plenty of examples, but I need to run right now. If you would not find them, I'll look them up tonight.

Naomi, I found them, and I found some of the specific threads on MSDN you and Erland and others participated in a few years back.

Second, the specific issue with ORDER BY is if you use expressions in the ORDER BY - which I rarely use and I'd venture a guess most people who are using aggregation concatenation aren't using. But that was interesting to learn.

Here's the MSDN link that covers the core issue, which has some interesting points...
http://support.microsoft.com/default.aspx?scid=287515

Note the workaround does not recommend against in-line aggregation concatenation; rather, it recommends against using expressions in an ORDER BY. This might be splitting hairs, but I would question the use of the word "undocumented" if Microsoft's own documentation states the following:

In order to achieve the expected results from an aggregate concatenation query, apply any Transact-SQL function or expression to the columns in the SELECT list rather than in the ORDER BY clause.

So I would state that so long as one doesn't use expressions in an ORDER BY, and deals with NULL values appropriately, I haven't seen anything that makes this less reliable than FOR XML.

And I'm not saying that FOR XML is bad - I've used it, and so have many. It's just that the aggregation concatenation approach is a bit simpler.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform