1

I have a single column of "names" on a text file. And I want to add this column to my database's table "names" that already exists and has a lot of names. That's looked very simple, but I don't know how to add the auto-incremental ID

I have something like this:

names
John
Lars
Peter

I wanted something like this.

 id | names
 .........
 68 | John
 69 | Lars
 70 | Peter

This is how I create my table:

CREATE TABLE IF NOT EXISTS `names` (
  `id` INT NOT NULL AUTO_INCREMENT COMMENT '',
  `name` VARCHAR(45) NOT NULL COMMENT '',
  PRIMARY KEY (`id`)  COMMENT '')
ENGINE = InnoDB;

enter image description here

Marcelo
  • 429
  • 1
  • 6
  • 19
  • this question is not related with pentaho data integration, just mysql http://stackoverflow.com/questions/14753321/add-auto-increment-id-to-existing-table – jacktrade Aug 12 '16 at 17:44

1 Answers1

1

There are two details to take in consideration:

1 - If you do not want two rows with the same name in the database. To accomplish that you must set only the name field in the lookup part of the insert/update task.

2 - If you can have two rows with the same name. Do not put anything in the lookup part of the insert/update task.

Kettle will not include the ID colummn in insert on both cases. Mysql will define the next ID automatically as the ID field is marked as auto_icrement.

UPDATE

Please, take a look in the target table field. You have defined the "domain" table instead of "names".

Jandisson
  • 380
  • 1
  • 10
  • You're right about the number 1: I don't want two rows with the same name. I remove the id column... But still, an error message appears when id column is not selected – Marcelo Aug 11 '16 at 21:49