Home > front end >  Update failing on DB2 i Series table (TIMESTAMP)
Update failing on DB2 i Series table (TIMESTAMP)

Time:11-12

I am trying to update a timestamp on DB2 i Series table but it is failing.

UPDATE table1
SET datetime1 = CURRENT TIMESTAMP
FROM table1 tbl1
INNER JOIN table2 tbl2 ON tbl1.ID = tbl2.ID

The error I am getting is that Keyword FROM not expected.

Thx in advance

CodePudding user response:

Such a syntax of the UPDATE statement is really not supported in Db2 for IBM i currently.

CodePudding user response:

As Mark mentions, Db2 for IBM i doesn't support joined updates.

I'd close this as a duplicate, as this question has many answers on SO. But since you're not actually using data from table 2, this should do what you want..

UPDATE table1 
  SET datetime1 = CURRENT_TIMESTAMP 
where id in (select id from table2);
  • Related