Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
Posted: Fri Oct 01, 2010 1:39 pm Post subject:
papadi,
I need to update a 9 position number. The leading zeroes were not loaded in the table. I will need to update multiply times depending on the number.
This is a one time fix.
Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
Posted: Fri Oct 01, 2010 2:21 pm Post subject:
Nascar9,
Here is a generic sql (untested) which would give you the desired results. The basic idea is to get the length of the leading spaces length using LTRIM and RTRIM functions and subtracting the lengths.
Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
Posted: Fri Oct 01, 2010 2:31 pm Post subject:
Thanks Kolusu,
I will need to test your query. This is what I ran
Code:
set text13 = CASE
WHEN (SUBSTR(text13,01,8)) = ' ' THEN '00000000' || (SUBSTR(text13,09,40))
WHEN (SUBSTR(text13,01,7)) = ' ' THEN '0000000' || (SUBSTR(text13,08,40))
WHEN (SUBSTR(text13,01,6)) = ' ' THEN '000000' || (SUBSTR(text13,07,40))
WHEN (SUBSTR(text13,01,5)) = ' ' THEN '00000' || (SUBSTR(text13,06,40))
WHEN (SUBSTR(text13,01,4)) = ' ' THEN '0000' || (SUBSTR(text13,05,40))
WHEN (SUBSTR(text13,01,3)) = ' ' THEN '000' || (SUBSTR(text13,04,40))
WHEN (SUBSTR(text13,01,2)) = ' ' THEN '00' || (SUBSTR(text13,03,40))
ELSE TEXT13
END
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum