Para criar um campo autoincremento
 
1ª  crie uma sequecia
 assim :
  CREATE SEQUENCE idcliid
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
 
2- na criação da tabela
 
CREATE TABLE fildiv
(
 id int4 NOT NULL DEFAULT nextval('public.idcliid::text),
 tipo int2 DEFAULT 0,
 inf text,
 id01 int4 DEFAULT 0,
 id02 int4 DEFAULT 0,
 CONSTRAINT fildiv_id_pk PRIMARY KEY (id)
 

 
----- Original Message -----
Sent: Thursday, March 16, 2006 4:05 PM
Subject: Re: [PostgreSQL-Brasil] AutoIncrement - Como usar?


ISSO É UMA TABELA TAMBÉM?
NÃO SAQUEI MUITO BEM ISSO.


Favor responder a [email protected]

Enviado Por:        [EMAIL PROTECTED]

Para:        <[email protected]>
cc:         (bcc: tiago machado 8100574/LIGHT)
Assunto:        Re: [PostgreSQL-Brasil] AutoIncrement - Como usar?

vc te usar uma sequecia
mais ou menos assim
 
 CREATE TABLE fildiv
(
 id int4 NOT NULL DEFAULT nextval('public.fildiv_id'::text),
 tipo int2 DEFAULT 0,
 inf text,
 id01 int4 DEFAULT 0,
 id02 int4 DEFAULT 0,
 CONSTRAINT fildiv_id_pk PRIMARY KEY (id)
)

----- Original Message -----
From: Fabricio Boaventura
To: [email protected]
Sent: Thursday, March 16, 2006 3:20 PM
Subject: [PostgreSQL-Brasil] AutoIncrement - Como usar?

Fale galera!!!
 
Tô iniciando com o Postgre e queria saber como faço pra usar o Auto Increment????
 
Tô usando o PgAdmin III
como aplico em uma tabela????
 
pode ser via codigo mesmo........
 
abraço...
 
 
Fabricio Boaventura


Yahoo! doce lar. Faça do Yahoo! sua homepage.


_______________________________________________
Grupo de Usuários do PostgreSQL no Brasil
http://www.postgresql.org.br
_______________________________________________
Grupo de Usuários do PostgreSQL no Brasil
http://www.postgresql.org.br



O conteúdo desta mensagem e seus anexos constitui informação confidencial. O seu uso,
divulgação, reprodução e/ou cópia são proibidos. Caso não seja o destinatário da mesma,
favor devolvê-la para o remetente e apagá-la em seguida.
--------------------------------------------------------------------------------------------------------
This message is intended only for the individual organization to which it is addressed and
contains confidential or privileged information. Any retransmission, dissemination or other
use of this information by anyone other than the intended recipient is prohibited. If you are
not the intended recipient please reply to or forward a copy of this message to the sender
and delete the message


_______________________________________________
Grupo de Usuários do PostgreSQL no Brasil
http://www.postgresql.org.br
_______________________________________________
Grupo de Usuários do PostgreSQL no Brasil
http://www.postgresql.org.br

Responder a