Sorry! Correction:
Select Repeat('0', 6 - Length(Trim(MyFld))) concat Trim(Text) as NewText,
a.*
From MyTable a
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Birgitta Hauser
Gesendet: Monday, 08. February 2010 14:55
An: 'Midrange Systems Technical Discussion'
Betreff: AW: Using SQL to obtain a 6 character field from a 3, 4, 5 or 6
character string
Hi,
Try the following:
Create View MySchema/MyView as
Select Repeat('0', Length(Trim(MyFld))) concat Trim(Text) as NewText,
a.*
From MyTable a
;
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Alan Shore
Gesendet: Monday, 08. February 2010 14:32
An: Midrange Systems Technical Discussion
Betreff: Using SQL to obtain a 6 character field from a 3, 4, 5 or 6
character string
Good morning all
what I am trying to achieve sounds so familiar. I believe this was a
discussion that happened a couple of years ago, but I cannot seem to find
it.
Probably searching for the wrong thing
Anyway, heres my dilemma
I have a file with a 10 character field (lets call it FIELDA)
Within this FIELDA, I can have a 3, 4, 5, or 6 character string (not
necessarily left adjusted)
This string happens to be numeric (but for my purposes - it needs to remain
alpha)
I need to convert this numeric string into a 6 character string with
leading zeroes
AND
I need to create a view/index over this file using this new field as the
key
It being Monday morning, not having my 18th cup of coffee, bleary eyed from
staying up too long after the super bowl etc. etc.
I just cannot get my head around this, therefore, as always, any and all
help would be MUCH appreciated
Thanks in advance
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
As an Amazon Associate we earn from qualifying purchases.