IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Select Junk Charaters


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue Dec 11, 2007 1:43 pm
Reply with quote

Can I query a table to select is there any junk characters present in that or not?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 11, 2007 1:45 pm
Reply with quote

please clarify the meaning of "JUNK" :-)
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue Dec 11, 2007 1:53 pm
Reply with quote

My query result should not contain any character except

0,1,2,3,4,5,6,7,8,9 or "."
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Tue Dec 11, 2007 6:36 pm
Reply with quote

Are you storing numeric data in a Text field in a database? That is just horrible design.

But you are contradicting yourself. First you ask if you can select junk characters then you say your result should only include
0,1,2,3,4,5,6,7,8,9 or ".". Are those what you are considering junk or are those the only valid characters?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Dec 11, 2007 6:51 pm
Reply with quote

What are formats of the columns?
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Wed Dec 12, 2007 12:43 pm
Reply with quote

Hi

Yrs...the following are the valid characters

0,1,2,3,4,5,6,7,8,9 or "."
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Wed Dec 12, 2007 5:06 pm
Reply with quote

I believe, u r handling some numeric number in CHAR field and in that some junk characters are coming un-expectedly, U want to remove them.

If this is the case, then

with the following wuery u can list out all the fields which contains the junk characters.


SELECT * FROM <TABLE-NAME>
WHERE <FIELD-NAME> BETWEEN '000000' AND '999999'
OR <FIELD-NAME> = '.'
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Dec 12, 2007 5:09 pm
Reply with quote

Quote:
BETWEEN '000000' AND '999999'


I would disagree on that, You are carrying on an alphanumeric compare
and with Your comparison "111aaa" would be legal :-)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Dec 12, 2007 5:37 pm
Reply with quote

tables do not have fields. I realize that rookies talk like that, but if you are providing 'professional' help, clean up your rap.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Dynamically pass table name to a sele... DB2 2
No new posts SELECT from data change table DB2 5
No new posts Select two different counts from SQL... DB2 6
No new posts Select a DB2 value in a specific deci... DB2 4
Search our Forums:

Back to Top