Home All Groups Group Topic Archive Search About

scientific notation and CAST or CONVERT

Author
12 Jan 2006 5:51 PM
Martha Hoffmann
Is it possible for me to return a very small number (5 or more decimal
places) as a string NOT in scientific notation using the CAST or CONVERT
function?  I want 0.0000769 not 7.96e-005.

Thanks,
Martha Hoffmann

Author
12 Jan 2006 5:57 PM
SQL
Is this what you are looking for?

select convert(varchar,convert(decimal(18,6),7.96e-005))

http://sqlservercode.blogspot.com/
Author
12 Jan 2006 6:03 PM
Martha Hoffmann
Yes, thank you very much.

Show quote
"SQL" <denis.g***@gmail.com> wrote in message
news:1137088677.594526.181190@g14g2000cwa.googlegroups.com...
> Is this what you are looking for?
>
> select convert(varchar,convert(decimal(18,6),7.96e-005))
>
> http://sqlservercode.blogspot.com/
>
Author
12 Jan 2006 6:08 PM
Martha Hoffmann
well, what i really want to do is get rid of trailing zeroes, not matter how
many decimal places.

Show quote
"Martha Hoffmann" <mhoff***@gcwda.com> wrote in message
news:eIvSGK6FGHA.4036@TK2MSFTNGP12.phx.gbl...
> Yes, thank you very much.
>
> "SQL" <denis.g***@gmail.com> wrote in message
> news:1137088677.594526.181190@g14g2000cwa.googlegroups.com...
>> Is this what you are looking for?
>>
>> select convert(varchar,convert(decimal(18,6),7.96e-005))
>>
>> http://sqlservercode.blogspot.com/
>>
>
>
Author
12 Jan 2006 6:13 PM
SQL
1 way

select
replace(rtrim(replace(convert(varchar,convert(decimal(18,6),7.96e-005)),'0','
')),' ','0')



http://sqlservercode.blogspot.com/

AddThis Social Bookmark Button