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

How to retrive first 3 digits from the table?


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

New User


Joined: 26 Oct 2007
Posts: 9
Location: bangalore

PostPosted: Tue Sep 23, 2008 1:48 pm
Reply with quote

How to retrive first 3 digits from the table?

The data declard decimal(10,0)

How to write SQL query?
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Sep 23, 2008 4:50 pm
Reply with quote

You can try this.
Code:
SUBSTR(DIGITS(COL1),1,3)
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Tue Sep 23, 2008 5:16 pm
Reply with quote

Srihari,

Did you execute this? I am getting invalid error.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Sep 23, 2008 5:25 pm
Reply with quote

ksk,

well if it is an INVALID ERROR it must be ok.

probably refered to your typing, unless you have a really old vsn of db2.

anyway, Srihari's syntax is ok.
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top