Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7UI2Pf16624 for ; Thu, 30 Aug 2001 14:02:25 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f7UHb5d57676 for pgsql-sql@postgresql.org; Thu, 30 Aug 2001 13:37:05 -0400 (EDT) (envelope-from news) From: Arne Weiner X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Help On Postgresql Date: Thu, 30 Aug 2001 19:46:50 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 33 Message-ID: <3B8E7C0A.276F4F44@gmx.de> References: <000801c12ba8$5924ab40$ca00a8c0@dewanji> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.2.18 i586) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200108/368 X-Sequence-Number: 4627 Jaydip wrote: > Dear Friends > > I am Jaydip Dewanji working as a Sr. Programmer for Ontrack Systems Ltd. > > I have some questions regarding Postgresql which are listed below: > > a) How do I retrieve the Year,Month,Day,Hr,Minute or Second value from a Da= > te/DateTime variable. > > For Example : i> In Oracle to_char(dt,'yyyy') - for extracting the year= > value from a date variable dt > ii> In SqlServer datepart(hh,dt) - for extracting = > the Hour value from a date variable dt I don't know what variables you are talking about. Which interface do yo use ? My client programs recieve plain text from postgres, so there are no variables. > b) Can I create an identity column in Postgresql the value of which column = > will start from 1 say and keep > on incrementing by 1 OR how can I serve my purpose in any other way. Use the data type SERIAL. If you say e.g. CREATE TABLE mytable ( key SERIAL, .... ); Then every time you insert a new row key will increment automatically. Arne.