Re: Auto Increment

Поиск
Список
Период
Сортировка
От prinsarian@zonnet.nl (Arian Prins)
Тема Re: Auto Increment
Дата
Msg-id 3bd3ca9f.5654630@news.amc.uva.nl
обсуждение исходный текст
Ответы Re: Auto Increment  (Cory Wright <corz@southcarrollton.net>)
Список pgsql-sql
On Mon, 22 Oct 2001 12:06:21 +0530, "Mayuresh Kadu"
<mayureshk@aftek.com> wrote:

>hi all,
>
>could anyone tell me how to make a primary key to AUTO INCREMENT. The
>document is not exactly very explainatory about it :)
>
>Thankx in advance ...
>
>
>
>Mayuresh
>
>

Try first creating a sequence and then using the sequence as a default
value in your table:


-- STEP 1: create sequence
create sequence mytableid_seq;

-- STEP 2: create table
create table mytable ( id int default nextval ('mytableid_seq'), anyvalue varchar primary key (id));


В списке pgsql-sql по дате отправления:

Предыдущее
От: chrup@mac.com
Дата:
Сообщение: Re: Diferent databases on same query...
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: [HACKERS] Index of a table is not used (in any case)