Page 1 of 1

how to check the field has numbers in it

Posted: Tue Nov 23, 2010 2:40 pm
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

Posted: Tue Nov 23, 2010 2:53 pm
by anbu

Code: Select all

If Str <> Convert('0123456789','',Str) Then Str : 'DR' Else Str

Posted: Tue Nov 23, 2010 2:58 pm
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

Posted: Tue Nov 23, 2010 3:08 pm
by anbu

Code: Select all

If Convert('0123456789 ','',Str) = '' Then 'DR' : Str Else Str

Posted: Tue Nov 23, 2010 3:18 pm
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

Posted: Wed Nov 24, 2010 10:45 am
by Sreenivasulu
You can use the 'isvalid' function

Regards
Sreeni

Posted: Wed Nov 24, 2010 10:58 am
by mobashshar
You can also use AlNum function