Re: insert a sequence

From: Ireneusz Pluta <ipluta(at)wp(dot)pl>
To: marchesini(at)unipg(dot)it
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: insert a sequence
Date: 2007-05-11 10:03:11
Message-ID: 46443F5F.7060603@wp.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gábriel Ákos 2007-05-11 14:00:37 PL/PGSQL Record type question
Previous Message chester c young 2007-05-10 18:34:22 Re: Count rows by day interval