Skip to main content
Inspiring
July 14, 2008
Question

Weird Value Returned to CF from SQL Stored Proc

  • July 14, 2008
  • 1 reply
  • 357 views
I am returning a result set from y SQL Stored Procedure to a CFC. I just noticed something strange with some of the values being returned.

When I run the query in a T-SQL window, I get the following result:

Value
-----------
0.00000000000000

However, when I run the SP with the same input values, and I dump the results on the CF page, I get the following:

VALUE
----------
0E-14

This is causing a problem for me, because I am throwing this into XML that is being sent to a Flex App, and when the Flex App sees this, it converts it to "-14", when it should be "0".

Can anyone help me with this? Why does this happen? How can prevent it?

Thank you.
This topic has been closed for replies.

1 reply

Inspiring
July 16, 2008
I suspect you are using an approximate data type (ie float) which is being converted to scientific notation.
http://msdn.microsoft.com/en-us/library/ms173773.aspx

You might try converting the value to a more precise datatype or alternatively converting it to a varchar. See the CAST and CONVERT functions in the BOL (Books on-line)