Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

What is the best way to generate unique ID numbers

I want to generate random but unique ID numbers in a certain format for insertion in a database - what is the recommended procedure to achieve this?
Labels (2)
18 Replies
Anonymous
Not applicable
Author

Is the column ID the PK for that table?
Is that represented in the schema too?
Anonymous
Not applicable
Author

Is the column ID the PK for that table?
Is that represented in the schema too?

Yes, absolutely.
Anonymous
Not applicable
Author

Let me repeat my other question as well - is it not possible to call the UUID() MySQL function in a tMap expression rather than through an explicit INSERT query?
Anonymous
Not applicable
Author

As far as Primary Key goes, it is indeed PK in the database which I am trying to write to, but the ID field does not exist in the Excel file I am reading from. And when I add it in the schema on the database side (of the Input connection) I get an error message saying that the schemas do not match. Do I need to use a tMap in order to have non-matching schemas?
Anonymous
Not applicable
Author

I added an ID field (key, not nullable) before the INSERT MySQL component ("leads") and that got rid of the error message, but still the resulting value of last_insert_id is 0.
Please see screenshot of where the id gets added in a tMap.
Anonymous
Not applicable
Author

hi,
have a look at https://community.talend.com/t5/Design-and-Development/resolved-How-to-use-UUID-keys-with-MySQL-in-T... ...
it could help you ... I hope 0683p000009MACn.png
regards
laurent
Anonymous
Not applicable
Author

hi,
have a look at https://community.talend.com/t5/Design-and-Development/resolved-How-to-use-UUID-keys-with-MySQL-in-T... ...
it could help you ... I hope 0683p000009MACn.png
regards
laurent

That looks perfect, thank you very much!
Anonymous
Not applicable
Author

I want to generate random UUID numbers in a certain format for insertion in a database - what is the recommended procedure to achieve this?
I have been ask to use routines but it does not work 0683p000009MPcz.png Theres a field in file called id and i wan to generate random uuid for every row to put it in my database
sasi8008
Contributor
Contributor

 Hi , 
Any One Can elaborate on this 
 I am Reading data from Mssql data base table ,its has UniqueIdentiifer Field, I want to Insert This uniqueidentifer filed to Target Table
 How to Insert UniqueIdentifer Filed to Target Table Through tmap or mssqloutput
 
Please help on this