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.