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 > help in SQL function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-04, 15:33
mark_tim1999 mark_tim1999 is offline
Registered User
 
Join Date: Dec 2003
Posts: 14
help in SQL function

Can anyone tell me how to get the records where UNIT has the numeric values?

UNIT_KEY(INT) UNIT(VARCHAR)
1000 ABCDE
2000 20
3000 10
4000 30
5000 HAHA

The result should be
UNIT_KEY(INT) UNIT(VARCHAR)
2000 20
3000 10
4000 30
Reply With Quote
  #2 (permalink)  
Old 03-05-04, 04:38
Dipanjan Dipanjan is offline
Registered User
 
Join Date: Sep 2003
Posts: 84
Think this should work :-
SELECT UNIT_KEY, UNIT from table where upper(UNIT) = UNIT and lower(UNIT) = UNIT
Reply With Quote
  #3 (permalink)  
Old 03-05-04, 13:48
chuzhoi chuzhoi is offline
Registered User
 
Join Date: Dec 2002
Posts: 134
the example above will not work on " ' , - and so on.
You can try using translate function:

SELECT UNIT_KEY, UNIT from table
where length(translate('UNIT', '', '1234567890'))=0
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