If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > First charactor should be number

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-29-09, 10:41
newer newer is offline
Registered User
 
Join Date: Sep 2003
Posts: 32
First charactor should be number

I want the query filter out first charactor that not be number

Field name is PRDNO, it could be 0102B, ab234 (filter out ab234)

select PRDNO
FROM file.lib
WHERE LEFT(PRDNO,1)=?

Thanks,

Lisa
Reply With Quote
  #2 (permalink)  
Old 06-29-09, 11:36
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
There will be many ways.
For example:
WHERE LOCATE(LEFT(PRDNO,1),'0123456789') = 0

WHERE TRANSLATE(LEFT(PRDNO,1),'*',' 0123456789') <> ''

WHERE LEFT(PRDNO,1) NOT BETWEEN '0' AND '9'

Last edited by tonkuma; 06-29-09 at 11:55.
Reply With Quote
  #3 (permalink)  
Old 06-29-09, 11:52
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Where Left(prdno,1) Not In ('0','1','2','3','4','5','6','7','8','9')
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On