Re: Auto increment

From: Adam Witney <awitney(at)sghms(dot)ac(dot)uk>
To: "Fontenot, Paul" <Paul(dot)Fontenot(at)bannerhealth(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Auto increment
Date: 2003-05-27 18:18:26
Message-ID: BAF96A82.1C4BB%a.witney@sghms.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Take a look at the SERIAL data type.

http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=datatype.htm
l

adam

> When creating a table how do you make an auto incrementing field? I'm
> using:
>
> Create table hosts (
> id int not null unique primary key,
> ip char(16),
> hostname text
> );
>
> Is there a way to make the host.id field automagicaly increment?
>
> ***PRIVILEGED & CONFIDENTIAL***
> Unless expressly stated otherwise, this message (and any attachment(s)
> thereto) is confidential and may be privileged. It is intended for the
> addressee(s) only. If you are not an addressee, any disclosure or
> copying of the contents of this e-mail or any action taken (or not
> taken) in reliance on it is strictly prohibited. If you are not an
> addressee, please inform sender immediately and delete this message from
> your system.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Doug Silver 2003-05-27 18:18:27 Re: Auto increment
Previous Message Nabil Sayegh 2003-05-27 18:17:27 Re: Auto increment