Format float as varchar
Posted on 2006-06-22
Hi, I have searched EE, but I must not be searching the correct keywords, as I can't find an answer to this one.
I have a column of type float "my_ref"
and I am just trying to append the value of this column to the value in the "name" column - which is a varchar
select my_ref, my_id, ( +'('+ cast(my_ref as varchar(255)) + ') '+ name) as my_ref_name from my_table
7.0010000000000003 The name
So when I run the query, I would expect the following (or I want this to happen):
(7.0010000000000003) The name
But instead, I get this:
(7.001) The name
Is there a way that I can get these results without changing the datatype from float?
If not, what bad things will happen if I change the datatype?