Обсуждение: auto increment
hi, i am creating a table and i want to add an auto incrementable field is that correct? psql ival << EOF create table partes ( codigo int not null auto_increment, usuario varchar(15), fecha date, proyecto varchar(30), horas int4, trabajo varchar(100), observaciones varchar(90), primary key(codigo)); EOF how can i do it? thanks in advance, marcos -- m a r c o s @ i v a l . e s
Marcos wrote: >hi, > > i am creating a table and i want to add an auto incrementable field > > is that correct? > >psql ival << EOF >create table partes ( >codigo int not null auto_increment, ^^^^^^^^^^^^^^ should be SERIAL -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "O death, where is thy sting? O grave, where is thy victory?" 1 Corinthians 15:55
On Jue 09 Nov 2000 07:56, Marcos wrote: > hi, > > i am creating a table and i want to add an auto incrementable field > > is that correct? > > psql ival << EOF > create table partes ( > codigo int not null auto_increment, WRONG. That is not ANSI-SQL. That is MySQL. Define it as SERIAL, just like all the good database servers do. > usuario varchar(15), > fecha date, > proyecto varchar(30), > horas int4, > trabajo varchar(100), > observaciones varchar(90), > primary key(codigo)); > EOF Try to read the user manual for information on querys. Saludos... :-) -- "And I'm happy, because you make me feel good, about me." - Melvin Udall ----------------------------------------------------------------- Mart�n Marqu�s email: martin@math.unl.edu.ar Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------