[MonetDB-users] COPY with AUTO_INCREMENT column
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,
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.ht...
To do the copy: http://monetdb.cwi.nl/projects/monetdb/SQL/Documentation/Data-Manipulation.h...
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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
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@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.ht...
To do the copy: http://monetdb.cwi.nl/projects/monetdb/SQL/Documentation/Data-Manipulation.h...
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@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
On Fri, Dec 07, 2007 at 10:23:48AM -0500, Venks wrote:
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' ;
Easiest way is to add the auto_increment column after finishing with loading, using some alter statement.
Anyway we do not have these special version of copy into. Also because post processing isn't supposed to be slow.
Niels
Thanks,
On Dec 7, 2007 9:55 AM, Romulo Goncalves R.A.Goncalves@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.ht...
To do the copy: http://monetdb.cwi.nl/projects/monetdb/SQL/Documentation/Data-Manipulation.h...
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@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@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
participants (3)
-
Niels Nes
-
Romulo Goncalves
-
Venks