One Star

[resolved] generating a new GUID for each insert

Hi I am new to Talend open studion ETL and has a question that I hope some of you experts will be able to assist me with.
I have an ETL job the selects data from an informix database processes then loads it into an MSSQL, when it inserts into the MSSQL i need to generate a new GUID with a command similar to 'select newid() as GUID' from the destination MSSQL DB for each new record I insert. I could do this by setting the db to generate but it's a third party db which has a web front end that I cannot make changes to so I need to do it as part of the load, I also need to use the new GUID in a second table (this is used to join the tables).
Can anyone suggest a way to run 'select newid() as GUID' each time I process a record to insert ?
Any help you can give will be greatly appriciated
Tony
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] generating a new GUID for each insert

In the end I used select newid() as GUID on the sql database then used tMap (Attached) to load a unique GUID for each record
3 REPLIES
Community Manager

Re: [resolved] generating a new GUID for each insert

Hi Tony
Hope this topic can help you,
http://www.talendforge.org/forum/viewtopic.php?id=4831
Create a routine and hard code to generate a GUID, insert it into DB on each row.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] generating a new GUID for each insert

The problem with generating a GUID outside the database is that it may not be unique as it doesn't follow the rules that the database is using for the table.
I've alwasy had to let the database create it and then retrieve it to use for the table join. A real pain but that's the problem with GUIDS. Globally unique and totally useless.
One Star

Re: [resolved] generating a new GUID for each insert

In the end I used select newid() as GUID on the sql database then used tMap (Attached) to load a unique GUID for each record