Pentaho Kettle, update value - pentaho

I would like to update a value some values stored in a table with some values from a file.
I know exactly which row to update as in my update file I've got the id of the row.
I've tried the different "update" steps but they don't seem to do exactly what I want.
For example, if I only select the data I need to update, kettle deletes the others fields.
Could you please explain me how to update only one field of my db ?
Thanks
Arnaud

Related

How to create a trigger that will only update a record if old record is different from new in SQL

Any table example would be appreciated how I would try going about comparing
Create Trigger Customer_Update
ON Customer UPDATE
AS
You can use 'inserted' and 'deleted' tables in SQL Server. Remember to cater for nultiple rows being updated. This question should help you out.

Comparing 2 tables (Insert, update or delete based on a secondary table)

Imagine I have two database tables which both have similar structure. So one of them is source and another is target.
I want to compare them using unique ID, something like what Redgate Data Compare does, here is the scenario:
For every new record, an INSERT command be executed.
If a record does not exist in source table anymore, a DELETE command omits that record in target table.
If a row has changed in source, an UPDATE command be executed.
I have tried an stored-procedure to loop through every record in source and compare it with target but it doesn't seem to be ideal.
I want to know what is the key word for such a comparison in SQL and I was wondering if there is any prewritten query for such a cases?
You can use MERGE command
check this link for example

How to decrement Auto column or Field by one using UPDATE SET on LibreOffice Base?

I have a table with auto increment column (ID) and have already filled my table with records. Then, after sometime I noticed that the auto increment (ID) column started from 2 instead of 1. I really wanted the count to start from 1. So, what I want to do is decrease the ID column by one for all the records using SQL statement UPDATE SET. I have used this SQL Statement on MySQL database and it worked. However, on LibreOffice base, it won't even allow me to execute Update statement saying that it is NOT a query. So, following is what I want to do.
UPDATE Accounts SET ID=ID-1;
Apparently, LibreOffice base doesn't like that sql statement. So, how can I do this?
It sounds like you tried to create a query, but that is not how to run an update command. Instead, go to Tools -> SQL and enter the following:
UPDATE "Accounts" SET ID=ID-1;
This was tested using the default HSQLDB engine.

Write SQL Cursor to populate all the missing rows on the extension table.

I am trying to update a table from one column to another column and once I executed the script, discovered that not all the rows updated. I was told I needed to write a SQL cursor to populate all missing rows on another table. Issue is, I am not sure how to form a cursor statement. All the how - tos I am reading are rather vague and don't explain anything. Would anyone have some basic hints on this?
Thanks!
Why do you need a cursor? If you want to insert missing tables from one table to another refer to the following post... Insert missing records from one table to another using mysql

SQL Server how to get last inserted data?

I ran a large query (~30mb) which inserts data in ~20 tables. Accidentally, I selected wrong database. There are only 2 tables with same name but with different columns. Now I want to make sure that no data is inserted in this database, I just don't know how.
If your table has a timestamp you can test for that.
Also sql-server keeps a log of all transactions.
See: https://web.archive.org/web/20080215075500/http://sqlserver2000.databases.aspfaq.com/how-do-i-recover-data-from-sql-server-s-log-files.html
This will show you how to examine the log to see if any inserts happened.
Best option go for Trigger
Use trigger to find the db name and
table name and all the history of
records manipulated