How to convert decimal to scientific in SQL Server 2008 R2 -
i have table named product. table looks this:
id product volume 1 xyz 4654.000000000000000 2 abc 121.000000000000000 i want represent volume in scientific notation. volume of datatype decimal(20,8).
how can conversion?
normally, formatting , presentation of data should done ui, on client side, if insist...
declare @t decimal(20,8) = 4654.000000000000000; select @t, convert(nvarchar(32), cast(@t float), 2) result
4654.00000000 4.654000000000000e+003 first cast decimal float (please note, may loose precision), convert float nvarchar using style 2:
always 16 digits. use in scientific notation.
note
float type has 15 digits of precision, can't store decimal(20,8) without loss of precision.
Comments
Post a Comment