
Anonymous
Not applicable
2008-12-02
10:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] MySQL last insert id
Hi,
I try to use the tMysqlLastInsertId componant but I don't understand how to use it.
Description of the job I've made:
- Read a spreadsheet file
- Insert data into database
- Log id of inserted data
You can see a screenshot of my job in attachment.
The problem is that the autogenerated "Last_insert_id" column contains always the value "0" instead of the value of autoincrement.
Does anyone know how can I get the value of autoincrement ?
Thx in advance for your help.
966 Views
- « Previous Replies
-
- 1
- 2
- Next Replies »
1 Solution
Accepted Solutions

Anonymous
Not applicable
2008-12-10
10:15 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Yes, we can get all the new inserted id. There is a global variable can be used to get the first new inserted id:
tMysqlOutput_1_NB_LINE: the total number of new inserted rows.
For more information, please see my screenshots.
Best regards
shong
How can I get the id for each row ?
It is possible ?
Yes, we can get all the new inserted id. There is a global variable can be used to get the first new inserted id:
tMysqlOutput_1_NB_LINE: the total number of new inserted rows.
For more information, please see my screenshots.
Best regards
shong
966 Views
18 Replies

Anonymous
Not applicable
2008-12-03
05:17 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
first you seem to have an error on your tMySQLOutput component (see red cross).
Despite this, in the db table, make sure your id is set to autoincrement.
first you seem to have an error on your tMySQLOutput component (see red cross).
Despite this, in the db table, make sure your id is set to autoincrement.
427 Views

Anonymous
Not applicable
2008-12-05
02:16 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Long-time lurker, first-time poster...
I'm having the same issue with virtually the same setup, though I don't have any compile problems in my job. In my tMySqlLastInsertId_1 component, I have tMySqlConnection_1 in my "Link with" field and I'm using a built-in schema. Any advice on this would be extremely helpful.
I'm having the same issue with virtually the same setup, though I don't have any compile problems in my job. In my tMySqlLastInsertId_1 component, I have tMySqlConnection_1 in my "Link with" field and I'm using a built-in schema. Any advice on this would be extremely helpful.
427 Views

Anonymous
Not applicable
2008-12-05
03:17 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello milou
Please see my screenshot.
Best regards
shong
Please see my screenshot.
Best regards
shong
427 Views

Anonymous
Not applicable
2008-12-05
04:43 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello shong,
I try to reproduce your example.
See my screenshot.
I've just replace the tRowGenerator componant by a tFileInputExcel.
When I run the job, I see 2 problems:
- I have value 0 instead of null for last_insert_id column in console.
- If you look at the statistics, 20 rows have been inserted into database.
But only one row is displayed in console for last_insert_id...
Do you know why ?
Thx for your help.
I try to reproduce your example.
See my screenshot.
I've just replace the tRowGenerator componant by a tFileInputExcel.
When I run the job, I see 2 problems:
- I have value 0 instead of null for last_insert_id column in console.
- If you look at the statistics, 20 rows have been inserted into database.
But only one row is displayed in console for last_insert_id...
Do you know why ?
Thx for your help.
427 Views

Anonymous
Not applicable
2008-12-06
12:47 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Can you show us your table structure? Is there a column defined as auto_increment in your talbe?
Best regards
shong
Can you show us your table structure? Is there a column defined as auto_increment in your talbe?
Best regards
shong
427 Views

Anonymous
Not applicable
2008-12-08
05:05 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi shong,
I've uploaded 2 screenshots:
- structure of my table (view from phpmyadmin)
- configuration of tMysqlOutput component (which insert value in my database)
You can see that my table has an autoincrement column as primary key.
I've uploaded 2 screenshots:
- structure of my table (view from phpmyadmin)
- configuration of tMysqlOutput component (which insert value in my database)
You can see that my table has an autoincrement column as primary key.
427 Views

Anonymous
Not applicable
2008-12-08
09:33 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello milou
I have run my job again with a table created on phpmyadmin and it works fine.
Please send me your job via email.
Best regards
shong
I have run my job again with a table created on phpmyadmin and it works fine.
Please send me your job via email.
Best regards
shong
427 Views

Anonymous
Not applicable
2008-12-09
04:45 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi shong,
I sent you my job by email this morning.
I sent you my job by email this morning.
427 Views

Anonymous
Not applicable
2008-12-10
03:44 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi shong,
I update my job and found what it doesn't work:
I must check option "use an existing connection" in the tMysqlOutput component
and select the good tMysqlConnection in drop down list.
So it works !
I get a not null last inserted id when I execute the job.
But if the job insert more than one row in my table, I only get the inserted id for the last row.
How can I get the id for each row ?
It is possible ?
I update my job and found what it doesn't work:
I must check option "use an existing connection" in the tMysqlOutput component
and select the good tMysqlConnection in drop down list.
So it works !
I get a not null last inserted id when I execute the job.
But if the job insert more than one row in my table, I only get the inserted id for the last row.
How can I get the id for each row ?
It is possible ?
427 Views

- « Previous Replies
-
- 1
- 2
- Next Replies »