× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 10 Feb 2013 15:13, A Paul wrote:
Value will contain one digit or max two digits on the left side of
the decimal point. So it could be 1.2500000000 or 12.500000000, all
positive values only.

So the remaining question for varied numeric values of the "VALUE" column was about the relevance of alignment in the outcome. If no matter, then the given statement should suffice; i.e. values greater than or equal to one but less than ten will align differently across rows than either those values from zero to less than one, and those values from ten to less than one hundred.

If alignment is important, and leading zeroes are acceptable, then use of the DIGITS() as shown by the response from Lim Hock-Chai should suffice.

If both alignment and no leading zeroes are required, then the either a more complex expression is required for the concatenation of the "VALUE" data to the string, or that complexity is best deferred to a UDF to perform the right-alignment of the numeric being cast to character [because the SQL provides no builtin scalar to do that :-( ].

Example rows with the smaller positive values:

DESCR1 VALUE
....+....1....+....2....+....3
XXX 01FEB 13 AXA INS LHRTD 12.50000000
XXX 01MAR 13 AXA INS LHRTD 1.25000000
XXYY 04MAR 13 AXA INS LHRTD 0.12500000

Effect using the expression I offered, the alignment is not fixed:

DESCR1 VALUE
....+....1....+....2....+....3
X 01FEB 13 AXA INS LHR 1250 12.50000000
X 01MAR 13 AXA INS LHR 125 1.25000000
X 04MAR 13 AXA INS LHR 12 .12500000

Effect using the expression using DIGITS, the alignment is fixed, but the numbers have leading zeroes:

DESCR1 VALUE
....+....1....+....2....+....3
X 01FEB 13 AXA INS LHR 1250 12.50000000
X 01MAR 13 AXA INS LHR 0125 1.25000000
X 04MAR 13 AXA INS LHR 0012 .12500000

Or perhaps neither of those is satisfactory, and the following is the desired effect?:

DESCR1 VALUE
....+....1....+....2....+....3
X 01FEB 13 AXA INS LHR 1250 12.50000000
X 01MAR 13 AXA INS LHR 125 1.25000000
X 04MAR 13 AXA INS LHR 12 .12500000


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.