From: | Arne Weiner <aswr(at)gmx(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Help On Postgresql |
Date: | 2001-08-30 17:46:50 |
Message-ID: | 3B8E7C0A.276F4F44@gmx.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2001-08-30 17:49:17 | Re: Help On Postgresql |
Previous Message | Stephan Szabo | 2001-08-30 17:42:59 | Re: Create table syntax |