Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Copy data from one column to another new column on the same table

Hi,
I need to copy all the data of a particular table column into a new column within the same table. But when copying data from source column to new column I need to transform the data of the source column (String to Double conversion). How can I achieve thin in Talend Open Studio for Data Integration. I'm using version 5.4.1.
Thanks and Regards,
Asanka.
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,
Use following jobs
tDBInput-->tMap-->tDBOutput
For above configuration you need a key column...
in tMap use key column and value of input column assign it to output column, use above transformation for your output column
Set key column in tDBOutput, this will insert the each input data from input column into the new column...
Thanks
Vaibhav

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Try this expression
Double.parseDouble(row.newColumn)
Anonymous
Not applicable
Author

Hi,
Use following jobs
tDBInput-->tMap-->tDBOutput
For above configuration you need a key column...
in tMap use key column and value of input column assign it to output column, use above transformation for your output column
Set key column in tDBOutput, this will insert the each input data from input column into the new column...
Thanks
Vaibhav
Anonymous
Not applicable
Author

Hi sanvaibhav,
Thanks for the replies. 
In my case the table doesn't have a key column. I tried the same steps suggested here before I start this topic. Is there any other ways to copy entire data of a particular column to a new column within the same table where the tables doesn't have a key column? Someone please advice on this.
Thanks and Regards,
Asanka. 
Anonymous
Not applicable
Author

Hi,
That does not matter whether your database has a key or not... in above configuration, set all the columns as key columns in tDBoutput component except newly added column and set update task
Another way could be ...
First read the table and put the contents in tHash component in tPreJob
Use tmap to add new column with required transformation and insert data into the database... may be if possible you can do truncate and load...
Thanks
Vaibhav
Anonymous
Not applicable
Author

Hi sanvaibhav,
Thank you very much for your reply. I tried your first options suggested in the above post. I set all columns as key columns of the tOracleOutput component (except newly created columns) and selected 'Update' option from Action on data options. But it doesn't copy the data from the old columns to the newly created columns. Have I missed any configurations in my job design?
Thanks and Regards,
Asanka.
Anonymous
Not applicable
Author

Have you set the value of old column to new column? i.e. in tMap output for new column, you set the value as row.oldColumn.
Vaibhav
Anonymous
Not applicable
Author

Hi Vaibhav,
Yes. I have set the values for the new column of the output. There are some null columns in the selected key column set. Can that be a issue? Cant we specify nullable column as a key in configuration?
Thanks and Regards,
Asanka.
Anonymous
Not applicable
Author

No... null can't be a key column value...
if all the columns are not mandatory you can select one or two which specify unique row and are not nullable
vaibhav
Anonymous
Not applicable
Author

Hi Viabhav,
Thanks for the information. Your suggestion solved my problem.
Thanks and Regards,
Asanka.