pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
insert a sequence
2+ messages / 2 participants
[nested] [flat]

* insert a sequence
@ 2007-05-10 14:49  ivan marchesini <marchesini@unipg.it>
  0 siblings, 1 reply; 2+ messages in thread

From: ivan marchesini @ 2007-05-10 14:49 UTC (permalink / raw)
  To: pgsql-sql

Dear postgres Users,
I have a simple question I think.
I have a table that contains some columns
one of these columns (the columns ID) contains distinct integer
values ...
I need to insert into this table some other records but I only need that
values were inserted into the ID column and that they were
progressive... (a sequence starting from 100 and ending to 300, step=1) 
the other columns must remains null....
can I do this with a sequence and then an "insert into"?

many thanks 




-- 
Ti prego di cercare di non inviarmi files .doc, .xls, .ppt, .dwg.
Preferisco formati liberi.
Please try to avoid to send me  .doc, .xls, .ppt, .dwg files.
I prefer free formats.
http://it.wikipedia.org/wiki/Formato_aperto
http://en.wikipedia.org/wiki/Open_format

Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a 
06125
Perugia (Italy)
e-mail: marchesini@unipg.it
        ivan.marchesini@gmail.com
tel: +39(0)755853760
fax (university): +39(0)755853756
fax (home): +39(0)5782830887
jabber: geoivan73@jabber.org




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: insert a sequence
@ 2007-05-11 10:03  Ireneusz Pluta <ipluta@wp.pl>
  parent: ivan marchesini <marchesini@unipg.it>
  0 siblings, 0 replies; 2+ messages in thread

From: Ireneusz Pluta @ 2007-05-11 10:03 UTC (permalink / raw)
  To: marchesini@unipg.it; +Cc: pgsql-sql

ivan marchesini napisaƂ(a):
> Dear postgres Users,
> I have a simple question I think.
> I have a table that contains some columns
> one of these columns (the columns ID) contains distinct integer
> values ...
> I need to insert into this table some other records but I only need that
> values were inserted into the ID column and that they were
> progressive... (a sequence starting from 100 and ending to 300, step=1) 
> the other columns must remains null....
> can I do this with a sequence and then an "insert into"?
>
> many thanks 
>
>
>
>
>   
INSERT INTO your_table (id) SELECT generate_series(100, 300, 1);

-> http://www.postgresql.org/docs/8.2/interactive/functions-srf.html




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-05-11 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-10 14:49 insert a sequence ivan marchesini <marchesini@unipg.it>
2007-05-11 10:03 ` Ireneusz Pluta <ipluta@wp.pl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox