pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karel Zak <zakkr@zf.jcu.cz>
To: Abdul Wahab Dahalan <wahab@mimos.my>
Cc: pgsql-sql@postgresql.org
Subject: Re: Display format for column
Date: Fri, 7 May 2004 11:58:32 +0200
Message-ID: <20040507095832.GB621@zf.jcu.cz> (raw)
In-Reply-To: <409B5205.5030803@mimos.my>
References: <409B5205.5030803@mimos.my>

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@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/



view thread (2+ messages)

Message-ID: <20040507095832.GB621@zf.jcu.cz>
Permalink:  ../20040507095832.GB621@zf.jcu.cz/
Also on:    postgresql.org/message-id/20040507095832.GB621@zf.jcu.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: zakkr@zf.jcu.cz, wahab@mimos.my
  Subject: Re: Display format for column
  In-Reply-To: <20040507095832.GB621@zf.jcu.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox