Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 2E52E9FB51F for ; Fri, 11 May 2007 07:10:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 81878-05 for ; Fri, 11 May 2007 07:09:53 -0300 (ADT) X-Greylist: delayed 00:06:39.333381 by SQLgrey-1.7.5 Received: from mx1.wp.pl (mx1.wp.pl [212.77.101.5]) by postgresql.org (Postfix) with ESMTP id 983BE9FB34D for ; Fri, 11 May 2007 07:09:56 -0300 (ADT) Received: (wp-smtpd smtp.wp.pl 8682 invoked from network); 11 May 2007 12:03:12 +0200 Received: from ip-213-17-164-70.netia.com.pl (HELO [127.0.0.1]) (ipluta@[213.17.164.70]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 11 May 2007 12:03:12 +0200 Message-ID: <46443F5F.7060603@wp.pl> Date: Fri, 11 May 2007 12:03:11 +0200 From: Ireneusz Pluta User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: marchesini@unipg.it CC: pgsql-sql@postgresql.org Subject: Re: insert a sequence References: <1178808572.4294.15.camel@ivangeo> In-Reply-To: <1178808572.4294.15.camel@ivangeo> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/81 X-Sequence-Number: 28361 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