May 28, 2008 at 11:47 am
Hi,
With "FOR XML AUTO", SQL 2005 returns XML with random generated column name (like XML_F2412216-XXX-....). Is there a way to return a fixed column name? Thanks.
Chris
May 28, 2008 at 12:11 pm
I believe you only get those if you don't give a column an alias, or if you have duplicate aliases. Make sure that those columns have actual names (or aliases if the name is a duplicate of some other column)
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
May 28, 2008 at 12:26 pm
Hi Matt,
Thanks for help. I have something like:
select a
b,
c,....
from tbl1
inner join ....
for XML auto
in my procedure. When I run it, it return:
XML_Frwrw........ --> column name
XML data
If I add "TYPE" at end of AUTO:
................. -> no column name
XML data
How could I make it to have somthing like:
Request ---> column name
XML data
That way front end knows return column name, thanks.
Chris
May 28, 2008 at 12:48 pm
Wow. Took me trying this on my end to see whic column you're talking about. Here's one way to do what you're looking for:
Select (
select a,
b,
c,....
from tbl1
inner join ....
for XML auto,TYPE
) as REQUEST
That being said - if you're spitting out XML - your front-ends are probably expecting XML, and not a SQL dataset with an XML column in it. You might care to take a look at these MSDN examples on how to skip the step above....
http://msdn.microsoft.com/en-us/library/ms180838.aspx
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
May 28, 2008 at 1:33 pm
Hi Matt,
Yes, that works. Thanks million!
Chris
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply