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 > listing data having specific constraints

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-18-11, 01:27
dineshrocks50 dineshrocks50 is offline
Registered User
 
Join Date: Aug 2011
Posts: 1
Smile listing data having specific constraints

Hi,

I just want to list the data in a 8 variable column whose specifications should be first three variabe must be a character and next five variables must be numeric. For example if the column name is USER_ID and i want to list the values having the data like 'AAANNNN'(ABC12345).

Can some one help me to sort this out?

I used the code like

select * from tablename where substr(USER_ID,1,3) is alpha and substr(USER_ID,4,5) is number

but no use, these functions are not available.
Reply With Quote
  #2 (permalink)  
Old 08-18-11, 01:59
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
functions are not available. ??
select * from tab where substr(col,1,1)='x' and substr(col,4,5)='x'
for substr which is a character based function you can not specify numbers
check the doc
SUBSTR
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
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