T-SQL Function to correctly display of n number of Significant Figures
Posted on 2011-03-23
I need a T-SQL Function to correctly display of n number of Significant Figures. All over the web we have people who think they know what "significant figures" are and they confuse if with decimal places. But I am talking about the most scientically accurate definition which is best explained as a function that would diplay a store value of 0.01 as 0.010; or a stored value of 0.0100 if Numeric(n,4) with two sig figs as: 0.010 . or a stored value of 0.005 displayed as 0.0050. Or 0.94 as 0.94. The decimal places will NOT be constant. Meaning you display two figures to the right starting with and including the value that is greater than zero. This is a question for a top SQL expert.