From mariya_yuniarti@yahoo.com Thu Apr 20 07:37:13 2006 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 457E511F6C1F for ; Thu, 20 Apr 2006 04:37:13 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -0.817 X-Spam-Level: X-Spam-Status: No, score=-0.817 required=5 tests=[BAYES_00=-2.599, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_WHOIS=1.447, HTML_50_60=0.134, HTML_MESSAGE=0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id 1FYcuDHHyfWd for ; Thu, 20 Apr 2006 04:37:10 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web33514.mail.mud.yahoo.com (web33514.mail.mud.yahoo.com [68.142.206.163]) by postgresql.org (Postfix) with SMTP id 55FD111F6C49 for ; Thu, 20 Apr 2006 04:37:09 -0300 (ADT) Received: (qmail 83454 invoked by uid 60001); 20 Apr 2006 07:37:08 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=EpZyflJZGKBQYqtk/X7nLXwQuwnRicuLMD7qF7JZA7WJjcULKGyvzeWTbsWKq/aLQXhx3lcQtdOnTRPgIEjl72IeR2A53uQd+8gFFBOYGS9D1tiFec4HjvWoYlrUeYbhv9I/+IvxEEmZqAx0lhZw/da+S4o43JKZYcO9n0kvj0M= ; Message-ID: <20060420073708.83452.qmail@web33514.mail.mud.yahoo.com> Received: from [222.124.227.199] by web33514.mail.mud.yahoo.com via HTTP; Thu, 20 Apr 2006 00:37:08 PDT Date: Thu, 20 Apr 2006 00:37:08 -0700 (PDT) From: Mariya Yuniarti Subject: ask syntax sql to get length of field To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-963241340-1145518628=:81761" Content-Transfer-Encoding: 8bit X-Archive-Number: 200604/134 X-Sequence-Number: 24943 --0-963241340-1145518628=:81761 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Here Question : I have table A with structure : Number Character(20), Description Character(50) I want to get length of field Number (20) What is syntax sql to get length of field ? thx --------------------------------- Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates. --0-963241340-1145518628=:81761 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Here Question :

I have table A with structure :

       Number        Character(20),
       Description   Character(50)

I want to get length of field Number (20)

What is syntax sql to get length of field ?

thx


Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates. --0-963241340-1145518628=:81761-- From bruno@wolff.to Thu Apr 20 15:22:05 2006 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 9F65B11F68DC for ; Thu, 20 Apr 2006 12:22:05 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -2.591 X-Spam-Level: X-Spam-Status: No, score=-2.591 required=5 tests=[AWL=0.008, BAYES_00=-2.599] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id euplamLLXV80 for ; Thu, 20 Apr 2006 12:22:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 629DF11F6252 for ; Thu, 20 Apr 2006 12:22:02 -0300 (ADT) Received: (qmail 11756 invoked by uid 500); 20 Apr 2006 15:23:48 -0000 Date: Thu, 20 Apr 2006 10:23:48 -0500 From: Bruno Wolff III To: Mariya Yuniarti Cc: pgsql-sql@postgresql.org Subject: Re: ask syntax sql to get length of field Message-ID: <20060420152348.GA11024@wolff.to> Mail-Followup-To: Bruno Wolff III , Mariya Yuniarti , pgsql-sql@postgresql.org References: <20060420073708.83452.qmail@web33514.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060420073708.83452.qmail@web33514.mail.mud.yahoo.com> User-Agent: Mutt/1.4.2.1i X-Archive-Number: 200604/139 X-Sequence-Number: 24948 On Thu, Apr 20, 2006 at 00:37:08 -0700, Mariya Yuniarti wrote: > Here Question : > > I have table A with structure : > > Number Character(20), > Description Character(50) > > I want to get length of field Number (20) > > What is syntax sql to get length of field ? Are you looking to get 20 or the length of a particular string in that column? If you are looking for the maximum length (20), that should be available in the catalogs. For the string length you can look in the string functions section of the document. I am not sure whether or not trailing spaces are counted in char columns. varchar makes more sense if you actually have variable length strings.