niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » IBM DB2
DB2 CLP - formatting text columns
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
relaxedrob@optushome.com.
*nix forums beginner


Joined: 10 Feb 2005
Posts: 5

PostPosted: Thu Feb 10, 2005 12:08 am    Post subject: DB2 CLP - formatting text columns Reply with quote

Hi All!

I am using the DB2 CLP tool and want to format my text columns in a
query to truncate the results of a wide text field - 50 char field but
I want to display only the first 10 chars.

My base query:
SELECT EPT620.FORM_TYPE, EPT620.CREATED_BY, EPT620.STATUS,
EPT634.SURNAME \
FROM DB2ADMIN.EPT620 EPT620, DB2ADMIN.EPT634 EPT634 \
WHERE EPT634.UNPAID_LEAVE_FORM_ID = EPT620.FORMID

1)
How do I specify colum formatting?

2)
Where do I find help on this? The help system here:
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp
is so confusing!

Thanks for any assistnace!

Rob
Smile
Back to top
Jan M. Nelken
*nix forums Guru Wannabe


Joined: 26 May 2005
Posts: 126

PostPosted: Thu Feb 10, 2005 1:14 am    Post subject: Re: DB2 CLP - formatting text columns Reply with quote

relaxedrob@optushome.com.au wrote:
Quote:
Hi All!

I am using the DB2 CLP tool and want to format my text columns in a
query to truncate the results of a wide text field - 50 char field but
I want to display only the first 10 chars.

My base query:
SELECT EPT620.FORM_TYPE, EPT620.CREATED_BY, EPT620.STATUS,
EPT634.SURNAME \
FROM DB2ADMIN.EPT620 EPT620, DB2ADMIN.EPT634 EPT634 \
WHERE EPT634.UNPAID_LEAVE_FORM_ID = EPT620.FORMID

1)
How do I specify colum formatting?

2)
Where do I find help on this? The help system here:
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp
is so confusing!

Thanks for any assistnace!

Rob
Smile

1) For a base query:

SELECT TABNAME FROM SYSCAT.TABLES WHERE TABSCHEMA='DB2ADMIN'

which returns TABNAME as VARCHAR(128) if I want to display only 8 characters
of table name - and as a bonus get warning when actual name is longer,
I would use:

SELECT CAST(TABNAME AS CHAR(Cool) FROM SYSCAT.TABLES WHERE TABSCHEMA='DB2ADMIN'

and get this output:

1
--------
CL_SCHED
DEPARTME
SQL0445W Value "DEPARTMENT" has been truncated. SQLSTATE=01004

EMP_ACT
EMP_PHOT
SQL0445W Value "EMP_PHOTO" has been truncated. SQLSTATE=01004

EMP_RESU
SQL0445W Value "EMP_RESUME" has been truncated. SQLSTATE=01004

EMPLOYEE
IN_TRAY
ORG
PROJECT
SALES
STAFF

11 record(s) selected with 3 warning messages printed.


2) I derived that from
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp

What is so confusing about it?


Jan M. Nelken
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 2:06 am | All times are GMT
navigation Forum index » Databases » IBM DB2
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Oracle Text Score Computation jatinder.1975@gmail.com Server 0 Fri Jul 21, 2006 1:00 pm
No new posts FAQ 4.34 How do I extract selected columns from a string? PerlFAQ Server Perl 0 Fri Jul 21, 2006 7:03 am
No new posts PIL - transparent ImageDraw.text() aljosa python 1 Wed Jul 19, 2006 3:43 pm
No new posts user supplied forum text and htmlentities Sandy.Pittendrigh@gmail.c PHP 1 Wed Jul 19, 2006 2:19 pm
No new posts text representation of HTML Ksenia Marasanova python 5 Wed Jul 19, 2006 10:09 am

Online Loans | Libros arquitectura | Northern Rock | MPAA | Free File Hosting
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2441s ][ Queries: 16 (0.0763s) ][ GZIP on - Debug on ]