RE: Serial / Secuencia

From: MIGUEL CANCHAS <mcanchas(at)tsr(dot)com(dot)pe>
To: 'Miguel Rodríguez Penabad' <penabad(at)gmail(dot)com>, Guillermo Muñoz <guillermo(dot)munoz(at)grupotekne(dot)com(dot)ar>
Cc: Juan Martínez <jeugenio(at)umcervantes(dot)cl>, MIGUEL CANCHAS <mcanchas(at)tsr(dot)com(dot)pe>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: RE: Serial / Secuencia
Date: 2007-10-25 15:51:41
Message-ID: 410117BB01F4D611B73A00010331DD2403B58240@tsnt.tsr.com.pe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Mejor que mejor, es lo que deseaba, algo asi tenia sql server, solo que no
recordaba, no lo habia visto en su sintaxis, ahora que lo vuelvo a ver :

INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] |
query }
[ RETURNING * | output_expression [ AS output_name ] [, ...] ]

tiene RETURNING .

Excelente

MIL GRACIAS

Miguel

-----Mensaje original-----
De: Miguel Rodríguez Penabad [mailto:penabad(at)gmail(dot)com]
Enviado el: Jueves, 25 de Octubre de 2007 10:44 a.m.
Para: Guillermo Muñoz
CC: Juan Martínez; MIGUEL CANCHAS; Alvaro Herrera;
pgsql-es-ayuda(at)postgresql(dot)org
Asunto: Re: [pgsql-es-ayuda] Serial / Secuencia

¿Has considerado usar insert...returning..?

create table t(a serial, b int);

=>insert into t(b) values(1) returning a;
a
---
1
(1 row)

INSERT 0 1
=>insert into t(b) values(1) returning a;
a
---
2
(1 row)

INSERT 0 1

Saludos
--
Miguel Rodríguez Penabad

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message usuario anonimo 2007-10-25 15:51:50 Re: initdb no inicia la base de datos
Previous Message Juan Martínez 2007-10-25 15:48:00 Re: Serial / Secuencia