Skip site navigation (1) Skip section navigation (2)

Re: Display format for column

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Abdul Wahab Dahalan <wahab(at)mimos(dot)my>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Display format for column
Date: 2004-05-07 09:58:32
Message-ID: 20040507095832.GB621@zf.jcu.cz (view raw or flat)
Thread:
Lists: pgsql-sql
On Fri, May 07, 2004 at 05:08:21PM +0800, Abdul Wahab Dahalan wrote:
> Hi there!
> 
> How do we format column size for displaying data in postgresql.
> for example my data type for customername is varchar(100) and I want to 
> display the first 25 chars.
> How should I do that?

 "display" a data is a client problem only, but you can select part of
 string:

    # select substring('qwertyuiopasdfg' from 0 for 8);
     substring 
    -----------
      qwertyu
      
 or for your case:
 
    select substring(customername from 0 for 25) FROM yourtab;

 http://www.postgresql.org/docs/7.4/static/functions-string.html

    Karel

-- 
 Karel Zak  <zakkr(at)zf(dot)jcu(dot)cz>
 http://home.zf.jcu.cz/~zakkr/

In response to

pgsql-sql by date

Next:From: Andrew SullivanDate: 2004-05-07 11:16:28
Subject: Re: EXPORT / IMPORT
Previous:From: Abdul Wahab DahalanDate: 2004-05-07 09:08:21
Subject: Display format for column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group