Re: Create unique field..
От | Giorgio A. |
---|---|
Тема | Re: Create unique field.. |
Дата | |
Msg-id | 002b01c0ef9c$955535a0$0201a8c0@casa обсуждение исходный текст |
Ответ на | Create unique field.. ("Williams, Travis L, NPONS" <tlw@att.com>) |
Список | pgsql-novice |
try this: CREATE SEQUENCE "a_name_for_the_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; and when creating a table, add as the first column the following: "id" int4 DEFAULT nextval('a_name_for_the_seq'::text) NOT NULL the value of this column will be unique and autoincremental. Plz note that you won't specify the value of this column when you'll do your INSERT. hope this helps bye Giorgio A. ----- Original Message ----- From: "Williams, Travis L, NPONS" <tlw@att.com> To: <pgsql-novice@postgresql.org> Sent: Thursday, June 07, 2001 9:58 PM Subject: [NOVICE] Create unique field.. > All, > I'm not sure if I'm on the right track here.. I want to create a > column that is automatically filled in with a unique number when a row is > created.. I thought that creating a sequence would do this.. and then > creating a column with a default of nextval('seqname') but it isn't doing > anything.. any help is appreciated... > > Thanks, > Travis L. Williams > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl
В списке pgsql-novice по дате отправления: