lenygold via DBMonster.com wrote:
> I HAVE A STRING: ABCDEFG
>
> HOW TO INSERT A SPACE BETWEEN ALL CHARACTERS?
> REQUESTED OUTPUT:
>
> A B C D E F G
>
> Thank's in advance Leny G.
The TRANSLATE function [1] can be handy for this:
VALUES TRANSLATE('A B C D E F G H', SOMESTRING, 'ABCDEFGH')
For example:
SELECT
TRANSLATE('A B C D E F G H', S, 'ABCDEFGH')
FROM (
VALUES
('ABCD'),
('1234'),
('Testing')
) AS T(S)
Outputs:
1
---------------
A B C D
1 2 3 4
T e s t i n g
3 record(s) selected.
Just expand the first and third parameters with more characters if
extra length is required.
[1]
http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
uw.sql.ref.doc/doc/r0000862.html
Cheers,
Dave.