[MonetDB-users] COPY with AUTO_INCREMENT column

Venks venkatesh.mantha at gmail.com
Fri Dec 7 16:23:48 CET 2007


Please allow me to explain the problem in detail:

Here is my table definition:

CREATE TABLE test01 (
--
  id     INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
  col1   INT,
  col2   VARCHAR(10),
  col3   DATE
--
) ;

Here is my data:

11, aaa, 2007-12-01
12, bbb, 2007-12-02
11, ccc, 2007-12-03
12, ccc, 2007-12-04
15, ddd, 2007-12-02

I need to use COPY command to load the data. As you can see "id" is an
AUTO_INCREMENT column which won't have any corresponding data in the
data file. I tried the following syntax but didn't work.

COPY 5 RECORDS INTO test01(col1, col2, col3) FROM 'test01.txt' USING
DELIMITERS ',','\n' ;

Thanks,


On Dec 7, 2007 9:55 AM, Romulo Goncalves <R.A.Goncalves at cwi.nl> wrote:
> Maybe some documentation will help you.
>
> To create the table with auto-increment column which is also a primary key:
> http://monetdb.cwi.nl/projects/monetdb/SQL/Documentation/Table-Definition.html#Table-Definition
>
> To do the copy:
> http://monetdb.cwi.nl/projects/monetdb/SQL/Documentation/Data-Manipulation.html
>
> There you have the syntax tree that will help you to construct correctly
> your queries ;)
>
> Regards,
> Romulo
>
>
>
> Venks wrote:
> > Hi,
> >
> > How can I use COPY to load data into a table with a AUTO_INCREMENT
> > column? Just to clarify, the AUTO_INCREMENT column would be the
> > PRIMARY KEY by default and doesn't have any corresponding data in the
> > data file.
> >
> > Thanks,
> >
> > -------------------------------------------------------------------------
> > SF.Net email is sponsored by:
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://sourceforge.net/services/buy/index.php
> > _______________________________________________
> > MonetDB-users mailing list
> > MonetDB-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/monetdb-users
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> MonetDB-users mailing list
> MonetDB-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-users
>




More information about the users-list mailing list