February 4, 2013 at 6:35 am
I have a stored procedure that returns a XML string, I have a field 'Quantities' which contains an odd value : 3.100000000000e+003.
I know it's a numeric value and it is valid but is there a way to format it in TSQL so it's human readable?
Thanks.
February 4, 2013 at 6:50 am
Something like this?
--== SAMPLE DATA ==--
DECLARE @XML XML = '<YourXML><TheData value="3.100000000000e+003" /></YourXML>';
--== VIEW SAMPLE DATA==--
SELECT @XML;
/* Looks like this: -
<YourXML>
<TheData value="3.100000000000e+003" />
</YourXML>
*/
--==Convert from scientific notation==--
SELECT Data.value('(@value)[1]', 'REAL')
FROM @XML.nodes('./YourXML/TheData') yourXMLData(Data);
If not. . . supply sample data and expected result-set in your question. Otherwise, people just have to guess what you want.
February 4, 2013 at 7:08 am
Thank you, yes, I just came around the problem with the same type of solution.
Something like : str(cast('252536e+003' as real) )
Thanks again.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply