Answered by:
Remove scientific notation from xml column

Question
-
I have a xml column as shown below
<Root> <Row> <Rowid>1</Rowid> <date>2013-05-06</date> <Balance>1.0002E7</Balance> </Row> </Root>
When i query for getting balance i do get it as 1.0002E7 . But i want to get it as 10002000 .
How can i do it?
I have another question. Can i make any changes so that in xml column it self it store as i required without scientific notation.
Thank you
Friday, May 24, 2013 10:19 AM
Answers
-
Hello,
That's the quite normal XML notification for float values and if you handle it correctly as a float, then you get a correct result.
See http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#lexical-space
Olaf Helper
Blog Xing- Proposed as answer by Kalman Toth Friday, May 24, 2013 6:32 PM
- Marked as answer by Fanny Liu Friday, May 31, 2013 10:29 AM
Friday, May 24, 2013 2:37 PMAnswerer -
You can do conversion to decimal:
SELECT CONVERT(DECIMAL(20,0), 1.0002E7 ); -- 10002000
Kalman Toth Database & OLAP Architect sqlusa.com
New Book / Kindle: Pass SQL Exam 70-461 & Job Interview: Programming SQL Server 2012- Marked as answer by Fanny Liu Friday, May 31, 2013 10:29 AM
Friday, May 24, 2013 6:33 PM
All replies
-
Hello,
That's the quite normal XML notification for float values and if you handle it correctly as a float, then you get a correct result.
See http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#lexical-space
Olaf Helper
Blog Xing- Proposed as answer by Kalman Toth Friday, May 24, 2013 6:32 PM
- Marked as answer by Fanny Liu Friday, May 31, 2013 10:29 AM
Friday, May 24, 2013 2:37 PMAnswerer -
You can do conversion to decimal:
SELECT CONVERT(DECIMAL(20,0), 1.0002E7 ); -- 10002000
Kalman Toth Database & OLAP Architect sqlusa.com
New Book / Kindle: Pass SQL Exam 70-461 & Job Interview: Programming SQL Server 2012- Marked as answer by Fanny Liu Friday, May 31, 2013 10:29 AM
Friday, May 24, 2013 6:33 PM