Search Postgresql Archives

Re: multiple row insertion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 10/4/07, test tester <test896@xxxxxxxxx> wrote:
> > i have version 8.1 and i want to know how to insert multiple rows in this
> version.

Please don't top post.

If you need this functionality, you should really upgrade.

In cases where you want to insert multiple rows in version 8.1, you
could use COPY command:
   http://www.postgresql.org/docs/8.1/interactive/sql-copy.html

You use it like this:
COPY cars FROM STDIN DELIMITER AS ',' CSV;
5,toyota
6,ford
\.

Or if you really need to use INSERT you could use such construct:

INSERT INTO cars SELECT 5, 'toyota' UNION ALL SELECT 6, 'ford'
  UNION ALL SELECT 7, 'bmw';

In short: really get the 8.2 version.  8.2 is compatible with earlier
versions and will be coming soon.

  Regards,
     Dawid
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux