Re: [GENERAL] simple auto increment question.

Поиск
Список
Период
Сортировка
От Sferacarta Software
Тема Re: [GENERAL] simple auto increment question.
Дата
Msg-id 7601.980820@bo.nettuno.it
обсуждение исходный текст
Ответ на simple auto increment question.  (Jeremy Hansen <jeremy@xxedgexx.com>)
Список pgsql-general
Hello Jeremy,

giovedì, 20 agosto 98, you wrote:


JH> I want to create a simple auto increment field
JH> starting at 0000 for example.
                ^^^^  I supose you mean 1

JH> How do I do this in postgres?

JH> Thanks
JH> -jeremy

Examples:

   -- How to create a sequence starting with 1:
   --
   CREATE SEQUENCE serial START 1;


   -- How to assign the sequence as default to column <did>:

       CREATE TABLE distributors (
              did      INTEGER DEFAULT NEXTVAL('serial'),
              name     VARCHAR(40)
              );



Best regards,
   Jose'                            mailto:sferac@bo.nettuno.it



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

Предыдущее
От: Jeremy Hansen
Дата:
Сообщение: simple auto increment question.
Следующее
От: Javier Polo
Дата:
Сообщение: subscribe