MS SQL has a convenient workaround to combine a column value from several rows into a single value:
SELECT col1 FROM table1 WHERE col2 = 'x' ORDER by col3 FOR XML path('')
and returns a good set of records:
XML_F52E2B61-18A1-11d1-B105-00805F49916B ---------------------------------------- <col1>Foo</col1><col1>Bar</col1>
only the column name in the returned recordset is pretty nasty!
It looks like the column name contains random elements (or GUIDs) and therefore I am reluctant to use it in my application (different instances or different servers may have a different GUID). Unfortunately, I cannot use * to select a value, and due to limitations in an existing application, I cannot iterate over returned columns, ...
Is there a way to force the column name in the returned recordset to something more reasonable?
sql xml sql-server sql-server-2005
Eero Nov 20 '08 at 10:53 2008-11-20 10:53
source share