January 6, 2014 at 1:10 am
Hi all,
I have a script to generate XML data from a table:
SELECT [Key] as [Str Value],Value as [Str value]
FROM table1 as HashCell
FOR XML AUTo, ROOT('Hash'), Elements
In this query I put alias name as [Str Value], but when XML is generated from this query it gives me alias name in this manner:
<Hash>
<HashCell>
<Str_x0020_Value>btnAdd</Str_x0020_Value>
<Str_x0020_value>Aggiungi</Str_x0020_value>
</HashCell>
<HashCell>
<Str_x0020_Value>btnCancel</Str_x0020_Value>
<Str_x0020_value>anullare</Str_x0020_value>
</HashCell>
</Hash>
I want <Str Value> only instead of <Str_x0020_Value>.
How can I achieve this?
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 6, 2014 at 8:08 am
Short answer is - you can't get an XML tag called "str val", since XML does not allow for spaces in its tag names.
If you were to take the space out, you won't get the strange looking tag name.
----------------------------------------------------------------------------------
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?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply