|
|
|
|
|
|
| Author |
Message |
relaxedrob@optushome.com. *nix forums beginner
Joined: 10 Feb 2005
Posts: 5
|
Posted: Thu Feb 10, 2005 12:08 am Post subject:
DB2 CLP - formatting text columns
|
|
|
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
 |
|
| Back to top |
|
 |
Jan M. Nelken *nix forums Guru Wannabe
Joined: 26 May 2005
Posts: 126
|
Posted: Thu Feb 10, 2005 1:14 am Post subject:
Re: DB2 CLP - formatting text columns
|
|
|
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
|
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( ) 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 |
|
 |
|
|
The time now is Thu Jan 08, 2009 2:06 am | All times are GMT
|
|
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
|
|