how to check the field has numbers in it

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rajeevm
Participant
Posts: 135
Joined: Sun Jan 22, 2006 10:44 am

how to check the field has numbers in it

Post by rajeevm »

Hi,

I need your help in finding the solution. I have a column called E_NO which is Varchar(20) from the source but sometimes it has numbers in it I mean 146700 .Before loading this into target I need to add DR to it . But how can I check the field has numeric data . If numeric then add DR to it else pass it on the same

I appreciate your replies.

Thanks
rajeev
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

If Str <> Convert('0123456789','',Str) Then Str : 'DR' Else Str
You are the creator of your destiny - Swami Vivekananda
rajeevm
Participant
Posts: 135
Joined: Sun Jan 22, 2006 10:44 am

Post by rajeevm »

Hi anbu

I need to add DR in front of the numeric data

For example : I have 145000 from the source data as it is numeric it should be loaded into the target as DR145000

I need to check in for the numbers if it is then I need to append DR in front of it else pass it on the same to the target
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

If Convert('0123456789 ','',Str) = '' Then 'DR' : Str Else Str
You are the creator of your destiny - Swami Vivekananda
rajeevm
Participant
Posts: 135
Joined: Sun Jan 22, 2006 10:44 am

Post by rajeevm »

Thanks anbu

It worked Now the numeric data has been into the target with DR in front of it .

Thanks a lot .I really appreciate it.

rajeev
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

You can use the 'isvalid' function

Regards
Sreeni
mobashshar
Participant
Posts: 91
Joined: Wed Apr 20, 2005 7:59 pm
Location: U.S.

Post by mobashshar »

You can also use AlNum function
Post Reply