bpelletier
SSC-Addicted
Points: 434
More actions
April 20, 2004 at 2:09 pm
#107968
I have a table with floats and I want to format them in a view so that they are always displayed like 9.999e-03, always with 3 digits (and only 3 digits) to the right of the decimal. Is there a function, or some other method to do this?
Thank you,
Bob
vadba
SSChampion
Points: 11133
April 22, 2004 at 10:11 am
#503872
How about this:
CREATE FUNCTION dbo.uSN3(@n FLOAT)
RETURNS VARCHAR(12)
AS
BEGIN
-- delete charpos 6,7,8,9 after converting to scientific notation
RETURN Stuff(Convert(varchar(20), @n, 1), 6, 4, '')
END
Mike
April 22, 2004 at 2:55 pm
#503913
Thank you.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply