how to check the string contains A to Z or 0 to 9 Characters

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
uppalapati2003
Participant
Posts: 70
Joined: Thu Nov 09, 2006 2:14 am

how to check the string contains A to Z or 0 to 9 Characters

Post by uppalapati2003 »

Hi i am getting one string in that i need to check if the string is contains any spcial charecters, if contains i need to convert space for this i need to check the string . string A to Z and 0 to 9 other than this i need to convert space how to do this ? now iam checking the key board special char using of convert function but my reqirement is non key board spcial function also i need to convert space for this how to do the string cmparison with A to Z and 0 to 9 if not convert space
please advise on me in this.


Thanks in Advance
Last edited by uppalapati2003 on Thu Oct 25, 2007 12:37 am, edited 1 time in total.
Srini
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Please do not double-post the same question several times, it won't help you get an answer any faster. In fact it usually has the opposite effect.

the duplicate post can be found here


Moderator - Please delete this duplicate post
uppalapati2003
Participant
Posts: 70
Joined: Thu Nov 09, 2006 2:14 am

Post by uppalapati2003 »

I Request for forgiveness posting Double time. can any one hands on this.


Thanks in Advance
Srini
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

You need to use Char() within Convert Function

E.g To remove new line character:

Code: Select all


Convert(Char(10),' ',Col1)
Delete the other post before anyone replies to that.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

<sigh> this why I requested this thread "die" and even posted a link to the other thread so that people could follow it.

The CONVERT() function is good, but you would need to explicitly enter a very long function for all the non-displayable characters than need to be transposed to space, i.e.

Code: Select all

CONVERT(CHAR(1):CHAR(2):CHAR(3):CHAR(4):CHAR(5):CHAR(6),'      ',In.Column)
. Most efficient would be to create that string in a stage variable and declare it only once, then use it in the CONVERT() function.
uppalapati2003
Participant
Posts: 70
Joined: Thu Nov 09, 2006 2:14 am

Post by uppalapati2003 »

i am not sure which are all spcial charectors are coming becaiuse of that we need check input string contains A to Z and 0 to 9 otherwise we need put space
Srini
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

<sigh> this why I requested this thread "die" and even posted a link to the other thread so that people could follow it.
I Apoligize. I thought OP can delete the duplicate post easily since no one has replied to it.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

uppalapati2003 - you've now gotten the answer you need - just type in the 150 or so non-displayable CHAR codes (which you can look up on any ASCII chart) for your CONVERT() statement.
vikasjawa
Participant
Posts: 13
Joined: Tue Aug 29, 2006 3:20 am
Location: Gurgaon

Post by vikasjawa »

Hi,
Other way of doing this can be as:
Read character by character of the string and then use this derivation to replace any other special character to space: if index('65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|48|49|50|51|52|53|54|55|56|56|57|46|38|47|45|32' ,InputSingleCharacter,1) >=1then InputSingleCharacter else 32
Vikas Jawa
uppalapati2003
Participant
Posts: 70
Joined: Thu Nov 09, 2006 2:14 am

Post by uppalapati2003 »

Hi i am getting 1000000 rec perday which i need to check one varchar2 (255) column this column contains average of 30 char " srini#vas is a go@od b|ye " how to work on this .
Srini
Post Reply