• Please help support our sponsors by considering their products and services.
    Our sponsors enable us to serve you with this high-speed Internet connection and fast webservers you are currently using at ADSM.ORG.
    They support this free flow of information and knowledge exchange service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions
  • Community Tip: Please Give Thanks to Those Sharing Their Knowledge.

    If you receive helpful answer on this forum, please show thanks to the poster by clicking "LIKE" link for the answer that you found helpful.

  • Community Tip: Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING)

    Click the link above to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This notice will disappear after you have made at least 3 posts.

What's the deal with column widths and SELECT statements?

droach

ADSM.ORG Senior Member
#1
When doing SELECT statements from DSMADMC I usually truncate the fields if the results won't display in tabular format. Take FILESPACE_NAME for instance. Because of the length of this field, anytime you have that in a SELECT statement you won't get tabular format unless you truncate it.

So I use either CHAR or SUBST in the SELECT statement to truncate...something like this:
select substr(Filespace_name,1,20) as "12345678901234567890" , filespace_ID from filespaces

It puts out this as a result:
2019-03-14_130335.png

So my question is how can I prevent DSMADMC from adding all this additional width to the Filespace_Name column? I have truncated the field to 20 characters and have my column heading is also at 20 characters. In this case DSMADMC has added 21 additional characters to the column heading width, but my filespace name is still truncated at 20. Anyone know how to prevent this?
 

moon-buddy

ADSM.ORG Moderator
#2
I don't think you have the option of limiting the width unless you define it within the select statement.

By default, the output follows the character space limits allocated for that column.
 
#3
When doing SELECT statements from DSMADMC I usually truncate the fields if the results won't display in tabular format. Take FILESPACE_NAME for instance. Because of the length of this field, anytime you have that in a SELECT statement you won't get tabular format unless you truncate it.

So I use either CHAR or SUBST in the SELECT statement to truncate...something like this:
select substr(Filespace_name,1,20) as "12345678901234567890" , filespace_ID from filespaces

It puts out this as a result:
View attachment 1531

So my question is how can I prevent DSMADMC from adding all this additional width to the Filespace_Name column? I have truncated the field to 20 characters and have my column heading is also at 20 characters. In this case DSMADMC has added 21 additional characters to the column heading width, but my filespace name is still truncated at 20. Anyone know how to prevent this?

try select cast(filespace_name as char(20))

it does the trick for me
 

droach

ADSM.ORG Senior Member
#4
Using cast does not work for me. Does the same thing as cast and substr.

select cast(Filespace_name as char(20)), filespace_ID, cast(cap......
SQL:
Unnamed                                     FILESPACE_ID         Size_MB
----------------------------------------    -------------     -----------
/var/lib/docker/devi                                 1720            0.07
/var/lib/docker/devi                                 1719            0.04
/var/lib/docker/devi                                 1718            0.45
/var/lib/docker/devi                                 1717            3.09
/var/lib/docker/devi                                 1716            3.09
Edited by @marclant to properly display output.
 
Last edited by a moderator:

Advertise at ADSM.ORG

If you are reading this, so are your potential customer. Advertise at ADSM.ORG right now.

UpCloud high performance VPS at $5/month

Get started with $25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.

The Spectrum Protect TLA (Three-Letter Acronym): ISP or something else?

  • Every product needs a TLA, Let's call it ISP (IBM Spectrum Protect).

    Votes: 16 18.8%
  • Keep using TSM for Spectrum Protect.

    Votes: 52 61.2%
  • Let's be formal and just say Spectrum Protect

    Votes: 10 11.8%
  • Other (please comement)

    Votes: 7 8.2%

Forum statistics

Threads
31,448
Messages
133,971
Members
21,548
Latest member
cburns
Top